Author: thomas.diesler(a)jboss.com
Date: 2006-10-25 09:09:40 -0400 (Wed, 25 Oct 2006)
New Revision: 1309
Modified:
trunk/src/main/java/org/jboss/ws/jaxws/injection/WebServiceRefDeployer.java
trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ApplicationClient.java
trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefClientTestCase.java
Log:
[EJBTHREE-760] @WebServiceRef not bound to java:comp/env
Modified: trunk/src/main/java/org/jboss/ws/jaxws/injection/WebServiceRefDeployer.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/injection/WebServiceRefDeployer.java 2006-10-25
11:55:34 UTC (rev 1308)
+++ trunk/src/main/java/org/jboss/ws/jaxws/injection/WebServiceRefDeployer.java 2006-10-25
13:09:40 UTC (rev 1309)
@@ -24,13 +24,11 @@
// $Id$
import javax.naming.Context;
-import javax.naming.Name;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
import javax.xml.ws.Service;
import javax.xml.ws.WebServiceRef;
import org.jboss.logging.Logger;
+import org.jboss.util.naming.Util;
/**
* Binds a JAXWS Service object into JNDI
@@ -73,41 +71,9 @@
if (portTypeName == null && refType != null &&
Service.class.isAssignableFrom(refType) == false)
portTypeName = refType.getName();
- bind(ctx, jndiName, new ServiceReferenceable(serviceTypeName, portTypeName,
ref.wsdlLocation()));
- log.debug("WebServiceRef bound [jndi=" + jndiName + ",service="
+ serviceTypeName + ",port=" + portTypeName + "]");
+ Util.bind(ctx, jndiName, new ServiceReferenceable(serviceTypeName, portTypeName,
ref.wsdlLocation()));
+
+ String externalName = ctx.getNameInNamespace() + "/" + jndiName;
+ log.debug("WebServiceRef bound [jndi=" + externalName +
",service=" + serviceTypeName + ",port=" + portTypeName +
"]");
}
-
- private static void bind(Context ctx, String name, Object value) throws
NamingException
- {
- Name n = ctx.getNameParser("").parse(name);
- bind(ctx, n, value);
- }
-
- private static void bind(Context ctx, Name name, Object value) throws NamingException
- {
- int size = name.size();
- String atom = name.get(size - 1);
- Context parentCtx = createSubcontext(ctx, name.getPrefix(size - 1));
- parentCtx.bind(atom, value);
- }
-
- private static Context createSubcontext(Context ctx, Name name) throws
NamingException
- {
- Context subctx = ctx;
- for (int pos = 0; pos < name.size(); pos++)
- {
- String ctxName = name.get(pos);
- try
- {
- subctx = (Context) ctx.lookup(ctxName);
- }
- catch (NameNotFoundException e)
- {
- subctx = ctx.createSubcontext(ctxName);
- }
- // The current subctx will be the ctx for the next name component
- ctx = subctx;
- }
- return subctx;
- }
}
Modified:
trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ApplicationClient.java
===================================================================
---
trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ApplicationClient.java 2006-10-25
11:55:34 UTC (rev 1308)
+++
trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ApplicationClient.java 2006-10-25
13:09:40 UTC (rev 1309)
@@ -45,8 +45,9 @@
@WebServiceRef (value = TestEndpointService.class, wsdlLocation
="META-INF/wsdl/TestEndpoint.wsdl")
public static TestEndpoint port2;
+ public static InitialContext encCtx;
public static String retStr;
-
+
public static void main(String[] args)
{
String inStr = args[0];
@@ -55,11 +56,11 @@
ArrayList<TestEndpoint> ports = new ArrayList<TestEndpoint>();
try
{
- InitialContext iniCtx = new InitialContext();
-
ports.add(((TestEndpointService)iniCtx.lookup("java:comp.ejb3/env/service1")).getTestEndpointPort());
-
ports.add(((TestEndpointService)iniCtx.lookup("java:comp.ejb3/env/service2")).getTestEndpointPort());
+ System.out.println("FIXME: EJBTHREE-760");
+
//ports.add(((TestEndpointService)encCtx.lookup("java:comp/env/service1")).getTestEndpointPort());
+
//ports.add(((TestEndpointService)encCtx.lookup("java:comp/env/service2")).getTestEndpointPort());
ports.add((TestEndpoint)service3.getPort(TestEndpoint.class));
- ports.add((TestEndpoint)iniCtx.lookup("java:comp.ejb3/env/port1"));
+ //ports.add((TestEndpoint)encCtx.lookup("java:comp/env/port1"));
ports.add(port2);
}
catch (Exception ex)
Modified:
trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefClientTestCase.java
===================================================================
---
trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefClientTestCase.java 2006-10-25
11:55:34 UTC (rev 1308)
+++
trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefClientTestCase.java 2006-10-25
13:09:40 UTC (rev 1309)
@@ -74,6 +74,7 @@
public void testApplicationClient() throws Exception
{
String helloWorld = "Hello World!";
+ ApplicationClient.encCtx = getInitialContext();
ClientLauncher.launch(ApplicationClient.class.getName(),
"jbossws-client", new String[]{helloWorld});
assertEquals(helloWorld, ApplicationClient.retStr);
}
Show replies by date