Author: thomas.diesler(a)jboss.com
Date: 2006-10-26 19:49:01 -0400 (Thu, 26 Oct 2006)
New Revision: 1316
Added:
trunk/src/main/java/org/jboss/ws/jaxws/injection/ServiceRef.java
trunk/src/test/resources/jaxws/webserviceref/META-INF/jboss-web.xml
trunk/src/test/resources/jaxws/webserviceref/META-INF/jboss.xml
Modified:
trunk/
trunk/src/main/java/org/jboss/ws/jaxws/injection/ServiceObjectFactory.java
trunk/src/main/java/org/jboss/ws/jaxws/injection/ServiceReferenceable.java
trunk/src/main/java/org/jboss/ws/jaxws/injection/WebServiceRefDeployer.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitionsFactory.java
trunk/src/test/ant/build-jars-jaxws.xml
trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ApplicationClient.java
trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/EJB3Client.java
trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ServletClient.java
trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefClientTestCase.java
trunk/src/test/resources/jaxws/webserviceref/META-INF/jboss-client.xml
Log:
Support <service-ref> overrides for @WebServiceRef in jboss.xml, jboss-web.xml,
jboss-client.xml
Property changes on: trunk
___________________________________________________________________
Name: svn:ignore
-
clipboard.xml
output
output-eclipse
thirdparty
ant.properties
version.properties.md5
+
clipboard.xml
output
output-eclipse
thirdparty
ant.properties
version.properties.md5
clipboard.txt
Modified: trunk/src/main/java/org/jboss/ws/jaxws/injection/ServiceObjectFactory.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/injection/ServiceObjectFactory.java 2006-10-26
06:46:29 UTC (rev 1315)
+++ trunk/src/main/java/org/jboss/ws/jaxws/injection/ServiceObjectFactory.java 2006-10-26
23:49:01 UTC (rev 1316)
@@ -24,7 +24,10 @@
// $Id$
+import java.io.ByteArrayInputStream;
import java.io.File;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
@@ -33,6 +36,8 @@
import javax.naming.Context;
import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.RefAddr;
import javax.naming.Reference;
import javax.naming.spi.ObjectFactory;
import javax.xml.namespace.QName;
@@ -81,28 +86,45 @@
String serviceTypeName =
(String)ref.get(ServiceReferenceable.SERVICE_TYPE).getContent();
String portTypeName =
(String)ref.get(ServiceReferenceable.PORT_TYPE).getContent();
- String wsdlLocation =
(String)ref.get(ServiceReferenceable.WSDL_LOCATION).getContent();
+ ServiceRef serviceRef = unmarshallServiceRef(ref);
ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
Class serviceType = ctxLoader.loadClass(serviceTypeName);
Class portType = (portTypeName != null ? ctxLoader.loadClass(portTypeName) :
null);
-
+
if (Service.class.isAssignableFrom(serviceType) == false)
throw new IllegalArgumentException("WebServiceRef type '" +
serviceType + "' is not assignable to javax.xml.ws.Service");
-
+
Object target;
- URL wsdlURL = getWsdlLocationURL(serviceType, wsdlLocation);
- if (wsdlURL != null)
+ URL wsdlURL = getWsdlLocationURL(serviceType, serviceRef.getWsdlLocation());
+
+ // Generic javax.xml.ws.Service
+ if (serviceType == Service.class)
{
- Constructor ctor = serviceType.getConstructor(new Class[] { URL.class,
QName.class });
- target = (Service)ctor.newInstance(new Object[] { wsdlURL, null });
+ if (wsdlURL != null)
+ {
+ target = Service.create(wsdlURL, null);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Cannot create generic
javax.xml.ws.Service without wsdlLocation");
+ }
}
+ // Generated javax.xml.ws.Service subclass
else
{
- target = (Service)serviceType.newInstance();
+ if (wsdlURL != null)
+ {
+ Constructor ctor = serviceType.getConstructor(new Class[] { URL.class,
QName.class });
+ target = (Service)ctor.newInstance(new Object[] { wsdlURL, null });
+ }
+ else
+ {
+ target = (Service)serviceType.newInstance();
+ }
}
-
+
if (portTypeName != null && portTypeName.equals(serviceTypeName) ==
false)
{
Object port = null;
@@ -117,7 +139,7 @@
break;
}
}
-
+
if (port == null)
throw new WebServiceException("Cannot find getter for port type:
" + portTypeName);
}
@@ -131,6 +153,24 @@
}
}
+ private ServiceRef unmarshallServiceRef(Reference ref) throws ClassNotFoundException,
NamingException
+ {
+ ServiceRef sref;
+ RefAddr refAddr = ref.get(ServiceReferenceable.SERVICE_REF);
+ ByteArrayInputStream bais = new
ByteArrayInputStream((byte[])refAddr.getContent());
+ try
+ {
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ sref = (ServiceRef)ois.readObject();
+ ois.close();
+ }
+ catch (IOException e)
+ {
+ throw new NamingException("Cannot unmarshall service ref meta data, cause:
" + e.toString());
+ }
+ return sref;
+ }
+
private URL getWsdlLocationURL(Class type, String wsdlLocation)
{
URL wsdlURL = null;
Added: trunk/src/main/java/org/jboss/ws/jaxws/injection/ServiceRef.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/injection/ServiceRef.java 2006-10-26 06:46:29
UTC (rev 1315)
+++ trunk/src/main/java/org/jboss/ws/jaxws/injection/ServiceRef.java 2006-10-26 23:49:01
UTC (rev 1316)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.jaxws.injection;
+
+//$Id$
+
+import java.io.Serializable;
+
+/**
+ * Represents a <service-ref> element of the jboss.xml, jboss-web.xml,
jboss-client.xml deployment descriptor
+ * for the 5.0 schema
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ */
+public class ServiceRef implements Serializable
+{
+ private static final long serialVersionUID = 223039007880052172L;
+
+ private String encName;
+ private String wsdlLocation;
+ private String configName;
+ private String configFile;
+
+ public ServiceRef()
+ {
+ }
+
+ public ServiceRef(String name)
+ {
+ this.encName = name;
+ }
+
+ public String getEncName()
+ {
+ return encName;
+ }
+
+ public void setEncName(String name)
+ {
+ this.encName = name;
+ }
+
+ public String getWsdlLocation()
+ {
+ return wsdlLocation;
+ }
+
+ public void setWsdlLocation(String wsdlLocation)
+ {
+ this.wsdlLocation = wsdlLocation;
+ }
+
+ public String getConfigFile()
+ {
+ return configFile;
+ }
+
+ public void setConfigFile(String configFile)
+ {
+ this.configFile = configFile;
+ }
+
+ public String getConfigName()
+ {
+ return configName;
+ }
+
+ public void setConfigName(String configName)
+ {
+ this.configName = configName;
+ }
+
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append("[");
+ sb.append("name=").append(encName);
+ sb.append(",config-name=").append(configName);
+ sb.append(",config-file=").append(configFile);
+ sb.append(",wsdl=").append(wsdlLocation);
+ sb.append("]");
+ return sb.toString();
+ }
+}
Property changes on: trunk/src/main/java/org/jboss/ws/jaxws/injection/ServiceRef.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/src/main/java/org/jboss/ws/jaxws/injection/ServiceReferenceable.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/injection/ServiceReferenceable.java 2006-10-26
06:46:29 UTC (rev 1315)
+++ trunk/src/main/java/org/jboss/ws/jaxws/injection/ServiceReferenceable.java 2006-10-26
23:49:01 UTC (rev 1316)
@@ -24,6 +24,11 @@
// $Id$
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
+import javax.naming.BinaryRefAddr;
import javax.naming.NamingException;
import javax.naming.Reference;
import javax.naming.Referenceable;
@@ -41,19 +46,19 @@
*/
public class ServiceReferenceable implements Referenceable
{
- public static final String WSDL_LOCATION = "WSDL_LOCATION";
+ public static final String SERVICE_REF = "SERVICE_REF";
public static final String SERVICE_TYPE = "SERVICE_TYPE";
public static final String PORT_TYPE = "PORT_TYPE";
private String serviceType;
private String portType;
- private String wsdlLocation;
+ private ServiceRef sref;
- public ServiceReferenceable(String serviceType, String portType, String wsdlLocation)
+ public ServiceReferenceable(String serviceType, String portType, ServiceRef sref)
{
this.serviceType = serviceType;
this.portType = portType;
- this.wsdlLocation = wsdlLocation;
+ this.sref = sref;
}
/**
@@ -68,8 +73,24 @@
myRef.add(new StringRefAddr(SERVICE_TYPE, serviceType));
myRef.add(new StringRefAddr(PORT_TYPE, portType));
- myRef.add(new StringRefAddr(WSDL_LOCATION, wsdlLocation));
+ myRef.add(new BinaryRefAddr(SERVICE_REF, marshallServiceRef()));
return myRef;
}
+
+ private byte[] marshallServiceRef() throws NamingException
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
+ try
+ {
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(sref);
+ oos.close();
+ }
+ catch (IOException e)
+ {
+ throw new NamingException("Cannot marshall service ref, cause: " +
e.toString());
+ }
+ return baos.toByteArray();
+ }
}
\ No newline at end of file
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-26
06:46:29 UTC (rev 1315)
+++ trunk/src/main/java/org/jboss/ws/jaxws/injection/WebServiceRefDeployer.java 2006-10-26
23:49:01 UTC (rev 1316)
@@ -46,14 +46,19 @@
// Hide ctor
}
- public static void setupWebServiceRef(Context ctx, String jndiName, Class refType,
WebServiceRef ref) throws Exception
+ public static void setupWebServiceRef(Context ctx, String jndiName, Class refType,
WebServiceRef wsref, ServiceRef sref) throws Exception
{
+ String externalName = ctx.getNameInNamespace() + "/" + jndiName;
+ String refTypeName = (refType != null ? refType.getName() : null);
+ String wsrefString = "[name=" + wsref.name() + ",value=" +
wsref.value() + ",type=" + wsref.type() + ",wsdl=" +
wsref.wsdlLocation() + ",mapped=" + wsref.mappedName() + "]";
+ log.debug("setupWebServiceRef [jndi=" + externalName +
",refType=" + refTypeName + ",wsref=" + wsrefString +
",sref=" + sref + "]");
+
String serviceTypeName = null;
String portTypeName = null;
// #1 Use the explicit @WebServiceRef.value
- if (ref.value() != Object.class)
- serviceTypeName = ref.value().getName();
+ if (wsref.value() != Object.class)
+ serviceTypeName = wsref.value().getName();
// #2 Use the target ref type
if (serviceTypeName == null && refType != null &&
Service.class.isAssignableFrom(refType))
@@ -64,16 +69,17 @@
serviceTypeName = Service.class.getName();
// #1 Use the explicit @WebServiceRef.type
- if (ref.type() != Object.class)
- portTypeName = ref.type().getName();
+ if (wsref.type() != Object.class)
+ portTypeName = wsref.type().getName();
// #2 Use the target ref type
if (portTypeName == null && refType != null &&
Service.class.isAssignableFrom(refType) == false)
portTypeName = refType.getName();
-
- 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 +
"]");
+ // Set the wsdlLocation if there is no override already
+ if (sref.getWsdlLocation() == null && wsref.wsdlLocation().length() >
0)
+ sref.setWsdlLocation(wsref.wsdlLocation());
+
+ Util.bind(ctx, jndiName, new ServiceReferenceable(serviceTypeName, portTypeName,
sref));
}
}
Modified: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitionsFactory.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitionsFactory.java 2006-10-26
06:46:29 UTC (rev 1315)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitionsFactory.java 2006-10-26
23:49:01 UTC (rev 1316)
@@ -25,6 +25,7 @@
import java.io.InputStream;
import java.io.StringWriter;
+import java.net.ConnectException;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
@@ -33,6 +34,7 @@
import javax.wsdl.Definition;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
+import javax.xml.bind.JAXBContext;
import javax.xml.parsers.DocumentBuilder;
import org.jboss.logging.Logger;
@@ -97,7 +99,7 @@
if (wsdlLocation == null)
throw new IllegalArgumentException("URL cannot be null");
- log.trace("parse: " + wsdlLocation.toExternalForm());
+ log.debug("parse: " + wsdlLocation.toExternalForm());
EntityResolver entityResolver = new JBossWSEntityResolver();
WSDLDefinitions wsdlDefinitions = null;
@@ -189,13 +191,13 @@
wsdlInputStream.close();
}
}
- catch (RuntimeException rte)
+ catch (ConnectException ex)
{
- throw rte;
+ throw new WSDLException("Cannot connect to: " + wsdlLocation);
}
- catch (Exception e)
+ catch (Exception ex)
{
- throw new WSDLException(e);
+ throw new WSDLException("Cannot parse wsdlLocation: " + wsdlLocation,
ex);
}
}
Modified: trunk/src/test/ant/build-jars-jaxws.xml
===================================================================
--- trunk/src/test/ant/build-jars-jaxws.xml 2006-10-26 06:46:29 UTC (rev 1315)
+++ trunk/src/test/ant/build-jars-jaxws.xml 2006-10-26 23:49:01 UTC (rev 1316)
@@ -443,6 +443,7 @@
<include
name="org/jboss/test/ws/jaxws/webserviceref/Echo.class"/>
</classes>
<webinf
dir="${build.test.dir}/resources/jaxws/webserviceref/META-INF">
+ <include name="jboss-web.xml"/>
<include name="wsdl/**"/>
</webinf>
</war>
@@ -456,6 +457,7 @@
<include
name="org/jboss/test/ws/jaxws/webserviceref/Echo.class"/>
</fileset>
<metainf
dir="${build.test.dir}/resources/jaxws/webserviceref/META-INF">
+ <include name="jboss.xml"/>
<include name="wsdl/**"/>
</metainf>
</jar>
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-26
06:46:29 UTC (rev 1315)
+++
trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ApplicationClient.java 2006-10-26
23:49:01 UTC (rev 1316)
@@ -30,22 +30,51 @@
import org.jboss.logging.Logger;
+//Test on type with wsdlLocation
@WebServiceRef(name = "service1", value = TestEndpointService.class,
wsdlLocation = "META-INF/wsdl/TestEndpoint.wsdl")
+
+// Test multiple on type
@WebServiceRefs( {
- @WebServiceRef(name = "service2", value = TestEndpointService.class,
wsdlLocation = "META-INF/wsdl/TestEndpoint.wsdl"),
- @WebServiceRef(name = "port1", value = TestEndpointService.class, type =
TestEndpoint.class, wsdlLocation = "META-INF/wsdl/TestEndpoint.wsdl") })
+ @WebServiceRef(name = "service2", value = TestEndpointService.class),
+ @WebServiceRef(name = "port1", value = TestEndpointService.class, type =
TestEndpoint.class) })
public class ApplicationClient
{
// Provide logging
private static Logger log = Logger.getLogger(ApplicationClient.class);
- @WebServiceRef (name ="TestEndpointService", wsdlLocation
="META-INF/wsdl/TestEndpoint.wsdl")
+ // Test on field with name
+ @WebServiceRef(name = "TestEndpointService3")
public static TestEndpointService service3;
- @WebServiceRef (value = TestEndpointService.class, wsdlLocation
="META-INF/wsdl/TestEndpoint.wsdl")
+ // Test on field without name
+ @WebServiceRef
+ public static TestEndpointService service4;
+
+ // Test on method with value
+ @WebServiceRef(name = "TestEndpointService5")
+ public static void setServiceSetter5(TestEndpointService service)
+ {
+ ApplicationClient.service5 = service;
+ }
+ private static TestEndpointService service5;
+
+ // Test on method without name
+ @WebServiceRef
+ public static void setServiceSetter6(TestEndpointService service)
+ {
+ ApplicationClient.service6 = service;
+ }
+ private static TestEndpointService service6;
+
+ // Test on field with name and value
+ @WebServiceRef(name = "Port2", value = TestEndpointService.class)
public static TestEndpoint port2;
-
- public static InitialContext encCtx;
+
+ // Test on field with value
+ @WebServiceRef(value = TestEndpointService.class)
+ public static TestEndpoint port3;
+
+ public static InitialContext iniCtx;
public static String retStr;
public static void main(String[] args)
@@ -57,11 +86,21 @@
try
{
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(((TestEndpointService)iniCtx.lookup("java:comp/env/service1")).getTestEndpointPort());
+
//ports.add(((TestEndpointService)iniCtx.lookup("java:comp/env/service2")).getTestEndpointPort());
ports.add((TestEndpoint)service3.getPort(TestEndpoint.class));
- //ports.add((TestEndpoint)encCtx.lookup("java:comp/env/port1"));
+
//ports.add(((TestEndpointService)iniCtx.lookup("java:comp/env/TestEndpointService3")).getTestEndpointPort());
+ ports.add((TestEndpoint)service4.getPort(TestEndpoint.class));
+ //ports.add(((TestEndpointService)iniCtx.lookup("java:comp/env/" +
ApplicationClient.class.getName() + "/service4")).getTestEndpointPort());
+ ports.add((TestEndpoint)service5.getPort(TestEndpoint.class));
+
//ports.add(((TestEndpointService)iniCtx.lookup("java:comp/env/TestEndpointService5")).getTestEndpointPort());
+ ports.add((TestEndpoint)service6.getPort(TestEndpoint.class));
+ //ports.add(((TestEndpointService)iniCtx.lookup("java:comp/env/" +
ApplicationClient.class.getName() + "/serviceSetter6")).getTestEndpointPort());
+ //ports.add((TestEndpoint)iniCtx.lookup("java:comp/env/port1"));
ports.add(port2);
+ //ports.add((TestEndpoint)iniCtx.lookup("java:comp/env/Port2"));
+ ports.add(port3);
+ //ports.add((TestEndpoint)iniCtx.lookup("java:comp/env/" +
ApplicationClient.class.getName() + "/port3"));
}
catch (Exception ex)
{
@@ -78,4 +117,5 @@
retStr = inStr;
}
+
}
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/EJB3Client.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/EJB3Client.java 2006-10-26
06:46:29 UTC (rev 1315)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/EJB3Client.java 2006-10-26
23:49:01 UTC (rev 1316)
@@ -38,21 +38,50 @@
@RemoteBinding(jndiBinding = "/ejb3/EJB3Client")
@Stateless
+// Test on type with wsdlLocation
@WebServiceRef(name = "service1", value = TestEndpointService.class,
wsdlLocation = "META-INF/wsdl/TestEndpoint.wsdl")
+
+// Test multiple on type
@WebServiceRefs( {
- @WebServiceRef(name = "service2", value = TestEndpointService.class,
wsdlLocation = "META-INF/wsdl/TestEndpoint.wsdl"),
- @WebServiceRef(name = "port1", value = TestEndpointService.class, type =
TestEndpoint.class, wsdlLocation = "META-INF/wsdl/TestEndpoint.wsdl") })
+ @WebServiceRef(name = "service2", value = TestEndpointService.class),
+ @WebServiceRef(name = "port1", value = TestEndpointService.class, type =
TestEndpoint.class) })
public class EJB3Client implements EJB3Remote
{
// Provide logging
private static Logger log = Logger.getLogger(EJB3Client.class);
- @WebServiceRef(name = "TestEndpointService", wsdlLocation =
"META-INF/wsdl/TestEndpoint.wsdl")
+ // Test on field with name
+ @WebServiceRef(name = "TestEndpointService3")
public TestEndpointService service3;
- @WebServiceRef(value = TestEndpointService.class, wsdlLocation =
"META-INF/wsdl/TestEndpoint.wsdl")
+ // Test on field without name
+ @WebServiceRef
+ public TestEndpointService service4;
+
+ // Test on method with value
+ @WebServiceRef(name = "TestEndpointService5")
+ public void setServiceSetter5(TestEndpointService service)
+ {
+ this.service5 = service;
+ }
+ private TestEndpointService service5;
+
+ // Test on method without name
+ @WebServiceRef
+ public void setServiceSetter6(TestEndpointService service)
+ {
+ this.service6 = service;
+ }
+ private TestEndpointService service6;
+
+ // Test on field with name and value
+ @WebServiceRef(name = "Port2", value = TestEndpointService.class)
public TestEndpoint port2;
+ // Test on field with value
+ @WebServiceRef(value = TestEndpointService.class)
+ public TestEndpoint port3;
+
public String echo(String inStr)
{
log.info("echo: " + inStr);
@@ -64,8 +93,18 @@
ports.add(((TestEndpointService)iniCtx.lookup("java:comp.ejb3/env/service1")).getTestEndpointPort());
ports.add(((TestEndpointService)iniCtx.lookup("java:comp.ejb3/env/service2")).getTestEndpointPort());
ports.add((TestEndpoint)service3.getPort(TestEndpoint.class));
+
ports.add(((TestEndpointService)iniCtx.lookup("java:comp.ejb3/env/TestEndpointService3")).getTestEndpointPort());
+ ports.add((TestEndpoint)service4.getPort(TestEndpoint.class));
+ ports.add(((TestEndpointService)iniCtx.lookup("java:comp.ejb3/env/" +
getClass().getName() + "/service4")).getTestEndpointPort());
+ ports.add((TestEndpoint)service5.getPort(TestEndpoint.class));
+
ports.add(((TestEndpointService)iniCtx.lookup("java:comp.ejb3/env/TestEndpointService5")).getTestEndpointPort());
+ ports.add((TestEndpoint)service6.getPort(TestEndpoint.class));
+ ports.add(((TestEndpointService)iniCtx.lookup("java:comp.ejb3/env/" +
getClass().getName() + "/serviceSetter6")).getTestEndpointPort());
ports.add((TestEndpoint)iniCtx.lookup("java:comp.ejb3/env/port1"));
ports.add(port2);
+ ports.add((TestEndpoint)iniCtx.lookup("java:comp.ejb3/env/Port2"));
+ ports.add(port3);
+ ports.add((TestEndpoint)iniCtx.lookup("java:comp.ejb3/env/" +
getClass().getName() + "/port3"));
}
catch (Exception ex)
{
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ServletClient.java
===================================================================
---
trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ServletClient.java 2006-10-26
06:46:29 UTC (rev 1315)
+++
trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ServletClient.java 2006-10-26
23:49:01 UTC (rev 1316)
@@ -35,21 +35,50 @@
import org.jboss.logging.Logger;
+//Test on type with wsdlLocation
@WebServiceRef(name = "service1", value = TestEndpointService.class,
wsdlLocation = "WEB-INF/wsdl/TestEndpoint.wsdl")
+
+// Test multiple on type
@WebServiceRefs( {
- @WebServiceRef(name = "service2", value = TestEndpointService.class,
wsdlLocation = "WEB-INF/wsdl/TestEndpoint.wsdl"),
- @WebServiceRef(name = "port1", value = TestEndpointService.class, type =
TestEndpoint.class, wsdlLocation = "WEB-INF/wsdl/TestEndpoint.wsdl") })
+ @WebServiceRef(name = "service2", value = TestEndpointService.class),
+ @WebServiceRef(name = "port1", value = TestEndpointService.class, type =
TestEndpoint.class) })
public class ServletClient extends HttpServlet
{
// Provide logging
private static Logger log = Logger.getLogger(ServletClient.class);
- @WebServiceRef (name ="TestEndpointService", wsdlLocation
="WEB-INF/wsdl/TestEndpoint.wsdl")
+ // Test on field with name
+ @WebServiceRef(name = "TestEndpointService3")
public TestEndpointService service3;
+
+ // Test on field without name
+ @WebServiceRef
+ public TestEndpointService service4;
+
+ // Test on method with value
+ @WebServiceRef(name = "TestEndpointService5")
+ public void setServiceSetter5(TestEndpointService service)
+ {
+ this.service5 = service;
+ }
+ private TestEndpointService service5;
- @WebServiceRef (value = TestEndpointService.class, wsdlLocation
="WEB-INF/wsdl/TestEndpoint.wsdl")
+ // Test on method without name
+ @WebServiceRef
+ public void setServiceSetter6(TestEndpointService service)
+ {
+ this.service6 = service;
+ }
+ private TestEndpointService service6;
+
+ // Test on field with name and value
+ @WebServiceRef(name = "Port2", value = TestEndpointService.class)
public TestEndpoint port2;
-
+
+ // Test on field with value
+ @WebServiceRef(value = TestEndpointService.class)
+ public TestEndpoint port3;
+
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
{
@@ -63,8 +92,18 @@
ports.add(((TestEndpointService)iniCtx.lookup("java:comp/env/service1")).getTestEndpointPort());
ports.add(((TestEndpointService)iniCtx.lookup("java:comp/env/service2")).getTestEndpointPort());
ports.add((TestEndpoint)service3.getPort(TestEndpoint.class));
+
ports.add(((TestEndpointService)iniCtx.lookup("java:comp/env/TestEndpointService3")).getTestEndpointPort());
+ ports.add((TestEndpoint)service4.getPort(TestEndpoint.class));
+ ports.add(((TestEndpointService)iniCtx.lookup("java:comp/env/" +
getClass().getName() + "/service4")).getTestEndpointPort());
+ ports.add((TestEndpoint)service5.getPort(TestEndpoint.class));
+
ports.add(((TestEndpointService)iniCtx.lookup("java:comp/env/TestEndpointService5")).getTestEndpointPort());
+ ports.add((TestEndpoint)service6.getPort(TestEndpoint.class));
+ ports.add(((TestEndpointService)iniCtx.lookup("java:comp/env/" +
getClass().getName() + "/serviceSetter6")).getTestEndpointPort());
ports.add((TestEndpoint)iniCtx.lookup("java:comp/env/port1"));
ports.add(port2);
+ ports.add((TestEndpoint)iniCtx.lookup("java:comp/env/Port2"));
+ ports.add(port3);
+ ports.add((TestEndpoint)iniCtx.lookup("java:comp/env/" +
getClass().getName() + "/port3"));
}
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-26
06:46:29 UTC (rev 1315)
+++
trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefClientTestCase.java 2006-10-26
23:49:01 UTC (rev 1316)
@@ -74,7 +74,7 @@
public void testApplicationClient() throws Exception
{
String helloWorld = "Hello World!";
- ApplicationClient.encCtx = getInitialContext();
+ ApplicationClient.iniCtx = getInitialContext();
ClientLauncher.launch(ApplicationClient.class.getName(),
"jbossws-client", new String[]{helloWorld});
assertEquals(helloWorld, ApplicationClient.retStr);
}
Modified: trunk/src/test/resources/jaxws/webserviceref/META-INF/jboss-client.xml
===================================================================
--- trunk/src/test/resources/jaxws/webserviceref/META-INF/jboss-client.xml 2006-10-26
06:46:29 UTC (rev 1315)
+++ trunk/src/test/resources/jaxws/webserviceref/META-INF/jboss-client.xml 2006-10-26
23:49:01 UTC (rev 1316)
@@ -3,4 +3,77 @@
<jboss-client>
<jndi-name>jbossws-client</jndi-name>
-</jboss-client>
+
+ <!--
+ @WebServiceRef(name = "service1", value = TestEndpointService.class,
wsdlLocation = "META-INF/wsdl/TestEndpoint.wsdl")
+ <service-ref>
+ <service-ref-name>service1</service-ref-name>
+ <wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+ -->
+
+ <!--
+ @WebServiceRef(name = "service2", value = TestEndpointService.class)
+ -->
+ <service-ref>
+ <service-ref-name>service2</service-ref-name>
+ <wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef(name = "TestEndpointService3")
+ -->
+ <service-ref>
+ <service-ref-name>TestEndpointService3</service-ref-name>
+ <wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef
+ -->
+ <service-ref>
+
<service-ref-name>org.jboss.test.ws.jaxws.webserviceref.ApplicationClient/service4</service-ref-name>
+ <wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef(name = "TestEndpointService5")
+ -->
+ <service-ref>
+ <service-ref-name>TestEndpointService5</service-ref-name>
+ <wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef
+ -->
+ <service-ref>
+
<service-ref-name>org.jboss.test.ws.jaxws.webserviceref.ApplicationClient/serviceSetter6</service-ref-name>
+ <wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef(name = "port1", value = TestEndpointService.class, type =
TestEndpoint.class)
+ -->
+ <service-ref>
+ <service-ref-name>port1</service-ref-name>
+ <wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef(name = "Port2", value = TestEndpointService.class)
+ -->
+ <service-ref>
+ <service-ref-name>Port2</service-ref-name>
+ <wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef(value = TestEndpointService.class)
+ -->
+ <service-ref>
+
<service-ref-name>org.jboss.test.ws.jaxws.webserviceref.ApplicationClient/port3</service-ref-name>
+ <wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+</jboss-client>
\ No newline at end of file
Added: trunk/src/test/resources/jaxws/webserviceref/META-INF/jboss-web.xml
===================================================================
--- trunk/src/test/resources/jaxws/webserviceref/META-INF/jboss-web.xml 2006-10-26
06:46:29 UTC (rev 1315)
+++ trunk/src/test/resources/jaxws/webserviceref/META-INF/jboss-web.xml 2006-10-26
23:49:01 UTC (rev 1316)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 5.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
+
+<jboss-web>
+
+
+ <!--
+ @WebServiceRef(name = "service1", value = TestEndpointService.class,
wsdlLocation = "WEB-INF/wsdl/TestEndpoint.wsdl")
+ <service-ref>
+ <service-ref-name>service1</service-ref-name>
+ <wsdl-override>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+ -->
+
+ <!--
+ @WebServiceRef(name = "service2", value = TestEndpointService.class)
+ -->
+ <service-ref>
+ <service-ref-name>service2</service-ref-name>
+ <wsdl-override>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef(name = "TestEndpointService3")
+ -->
+ <service-ref>
+ <service-ref-name>TestEndpointService3</service-ref-name>
+ <wsdl-override>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef
+ -->
+ <service-ref>
+
<service-ref-name>org.jboss.test.ws.jaxws.webserviceref.ServletClient/service4</service-ref-name>
+ <wsdl-override>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef(name = "TestEndpointService5")
+ -->
+ <service-ref>
+ <service-ref-name>TestEndpointService5</service-ref-name>
+ <wsdl-override>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef
+ -->
+ <service-ref>
+
<service-ref-name>org.jboss.test.ws.jaxws.webserviceref.ServletClient/serviceSetter6</service-ref-name>
+ <wsdl-override>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef(name = "port1", value = TestEndpointService.class, type =
TestEndpoint.class)
+ -->
+ <service-ref>
+ <service-ref-name>port1</service-ref-name>
+ <wsdl-override>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef(name = "Port2", value = TestEndpointService.class)
+ -->
+ <service-ref>
+ <service-ref-name>Port2</service-ref-name>
+ <wsdl-override>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef(value = TestEndpointService.class)
+ -->
+ <service-ref>
+
<service-ref-name>org.jboss.test.ws.jaxws.webserviceref.ServletClient/port3</service-ref-name>
+ <wsdl-override>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+</jboss-web>
\ No newline at end of file
Property changes on: trunk/src/test/resources/jaxws/webserviceref/META-INF/jboss-web.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/test/resources/jaxws/webserviceref/META-INF/jboss.xml
===================================================================
--- trunk/src/test/resources/jaxws/webserviceref/META-INF/jboss.xml 2006-10-26 06:46:29
UTC (rev 1315)
+++ trunk/src/test/resources/jaxws/webserviceref/META-INF/jboss.xml 2006-10-26 23:49:01
UTC (rev 1316)
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 5.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss_5_0.dtd">
+
+<jboss>
+
+ <enterprise-beans>
+ <session>
+ <ejb-name>EJB3Client</ejb-name>
+
+ <!--
+ @WebServiceRef(name = "service1", value = TestEndpointService.class,
wsdlLocation = "META-INF/wsdl/TestEndpoint.wsdl")
+ <service-ref>
+ <service-ref-name>service1</service-ref-name>
+ <wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+ -->
+
+ <!--
+ @WebServiceRef(name = "service2", value = TestEndpointService.class)
+ -->
+ <service-ref>
+ <service-ref-name>service2</service-ref-name>
+ <wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef(name = "TestEndpointService3")
+ -->
+ <service-ref>
+ <service-ref-name>TestEndpointService3</service-ref-name>
+ <wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef
+ -->
+ <service-ref>
+
<service-ref-name>org.jboss.test.ws.jaxws.webserviceref.EJB3Client/service4</service-ref-name>
+ <wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef(name = "TestEndpointService5")
+ -->
+ <service-ref>
+ <service-ref-name>TestEndpointService5</service-ref-name>
+ <wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef
+ -->
+ <service-ref>
+
<service-ref-name>org.jboss.test.ws.jaxws.webserviceref.EJB3Client/serviceSetter6</service-ref-name>
+ <wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef(name = "port1", value = TestEndpointService.class, type =
TestEndpoint.class)
+ -->
+ <service-ref>
+ <service-ref-name>port1</service-ref-name>
+ <wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef(name = "Port2", value = TestEndpointService.class)
+ -->
+ <service-ref>
+ <service-ref-name>Port2</service-ref-name>
+ <wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef(value = TestEndpointService.class)
+ -->
+ <service-ref>
+
<service-ref-name>org.jboss.test.ws.jaxws.webserviceref.EJB3Client/port3</service-ref-name>
+ <wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+ </session>
+ </enterprise-beans>
+
+</jboss>
\ No newline at end of file
Property changes on: trunk/src/test/resources/jaxws/webserviceref/META-INF/jboss.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF