Author: heiko.braun(a)jboss.com
Date: 2007-07-16 07:54:17 -0400 (Mon, 16 Jul 2007)
New Revision: 3888
Modified:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/CommonServiceRefBinder.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefBinder.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefHandlerImpl.java
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/client/DummyServiceRefBinderJAXRPC.java
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/client/SunRIServiceObjectFactory.java
branches/hbraun/trunk/integration/sunri/src/test/resources/test-excludes.txt
branches/hbraun/trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceRefBinderJAXRPC.java
branches/hbraun/trunk/testsuite/src/resources/jaxws/samples/webserviceref/META-INF-secure/jboss-client.xml
branches/hbraun/trunk/testsuite/src/resources/jaxws/samples/webserviceref/META-INF/jboss-client.xml
branches/hbraun/trunk/testsuite/src/resources/jaxws/samples/webserviceref/META-INF/jboss.xml
Log:
Partly complete webserviceref tests
Modified:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/CommonServiceRefBinder.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/CommonServiceRefBinder.java 2007-07-16
11:47:27 UTC (rev 3887)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/CommonServiceRefBinder.java 2007-07-16
11:54:17 UTC (rev 3888)
@@ -22,6 +22,7 @@
package org.jboss.wsf.spi.deployment.serviceref;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
+import org.jboss.wsf.spi.WSFException;
import org.jboss.util.naming.Util;
import org.jboss.logging.Logger;
@@ -31,6 +32,8 @@
import javax.xml.ws.WebServiceRef;
import javax.xml.ws.WebServiceRefs;
import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceClient;
+import javax.xml.namespace.QName;
import javax.jws.HandlerChain;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Field;
@@ -58,25 +61,30 @@
// logging support
private static Logger log = Logger.getLogger(CommonServiceRefBinder.class);
- public void setupServiceRef(Context encCtx, String encName, AnnotatedElement
anElement, UnifiedServiceRefMetaData serviceRef) throws NamingException
+ private ClassLoader loader = null;
+
+ public void setupServiceRef(Context encCtx, String encName, AnnotatedElement
anElement, UnifiedServiceRefMetaData serviceRef, ClassLoader loader) throws
NamingException
{
WebServiceRef wsref = null;
+ if(null == anElement)
+ throw new IllegalArgumentException("There needs to be an annotated target
type available");
+
+ if(null == loader)
+ throw new IllegalArgumentException("There needs to be a classloader
available");
+
// Build the list of @WebServiceRef relevant annotations
List<WebServiceRef> wsrefList = new ArrayList<WebServiceRef>();
- if (anElement != null)
+ for (Annotation an : anElement.getAnnotations())
{
- for (Annotation an : anElement.getAnnotations())
+ if (an instanceof WebServiceRef)
+ wsrefList.add((WebServiceRef)an);
+
+ if (an instanceof WebServiceRefs)
{
- if (an instanceof WebServiceRef)
- wsrefList.add((WebServiceRef)an);
-
- if (an instanceof WebServiceRefs)
- {
- WebServiceRefs wsrefs = (WebServiceRefs)an;
- for (WebServiceRef aux : wsrefs.value())
- wsrefList.add(aux);
- }
+ WebServiceRefs wsrefs = (WebServiceRefs)an;
+ for (WebServiceRef aux : wsrefs.value())
+ wsrefList.add(aux);
}
}
@@ -179,6 +187,24 @@
serviceRef.setHandlerChain(handlerChain);
}
+ // Extract service QName for target service
+ if(null == serviceRef.getServiceQName())
+ {
+ try
+ {
+ Class serviceClass = loader.loadClass(serviceImplClass);
+ if(serviceClass.getAnnotation(WebServiceClient.class) !=null)
+ {
+ WebServiceClient clientDecl =
(WebServiceClient)serviceClass.getAnnotation(WebServiceClient.class);
+ serviceRef.setServiceQName( new QName(clientDecl.targetNamespace(),
clientDecl.name()));
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ WSFException.rethrow("Cannot extract service QName for target
service", e);
+ }
+ }
+
// Do not use rebind, the binding should be unique
// [JBWS-1499] - Revisit WebServiceRefHandler JNDI rebind
Referenceable serviceReferenceable = buildServiceReferenceable(serviceImplClass,
targetClassName, serviceRef);
Modified:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefBinder.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefBinder.java 2007-07-16
11:47:27 UTC (rev 3887)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefBinder.java 2007-07-16
11:54:17 UTC (rev 3888)
@@ -39,6 +39,6 @@
public final static String JAXWS_BINDER = "WSServiceRefBinderJAXWS";
- void setupServiceRef(Context encCtx, String encName, AnnotatedElement anElement,
UnifiedServiceRefMetaData serviceRef)
- throws NamingException;
+ void setupServiceRef(Context encCtx, String encName, AnnotatedElement anElement,
UnifiedServiceRefMetaData serviceRef, ClassLoader loader)
+ throws NamingException;
}
Modified:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefHandlerImpl.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefHandlerImpl.java 2007-07-16
11:47:27 UTC (rev 3887)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefHandlerImpl.java 2007-07-16
11:54:17 UTC (rev 3888)
@@ -126,7 +126,7 @@
else
{
AnnotatedElement anElement = (AnnotatedElement)sref.getAnnotatedElement();
- jaxwsBinder.setupServiceRef(encCtx, encName, anElement, serviceRef);
+ jaxwsBinder.setupServiceRef(encCtx, encName, anElement, serviceRef, loader);
}
}
finally
Modified:
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/client/DummyServiceRefBinderJAXRPC.java
===================================================================
---
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/client/DummyServiceRefBinderJAXRPC.java 2007-07-16
11:47:27 UTC (rev 3887)
+++
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/client/DummyServiceRefBinderJAXRPC.java 2007-07-16
11:54:17 UTC (rev 3888)
@@ -34,7 +34,7 @@
*/
public class DummyServiceRefBinderJAXRPC implements ServiceRefBinder
{
- public void setupServiceRef(Context encCtx, String encName, AnnotatedElement
anElement, UnifiedServiceRefMetaData serviceRef) throws NamingException
+ public void setupServiceRef(Context encCtx, String encName, AnnotatedElement
anElement, UnifiedServiceRefMetaData serviceRef, ClassLoader loader) throws
NamingException
{
throw new IllegalArgumentException("The Sun-RI stack doesnt support JAX-RPC
service-ref deployments");
}
Modified:
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/client/SunRIServiceObjectFactory.java
===================================================================
---
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/client/SunRIServiceObjectFactory.java 2007-07-16
11:47:27 UTC (rev 3887)
+++
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/client/SunRIServiceObjectFactory.java 2007-07-16
11:54:17 UTC (rev 3888)
@@ -205,7 +205,7 @@
// Verify it. There is some know coinstraints
if(null == sref.getServiceQName())
throw new IllegalArgumentException("ServiceQName may not be null. " +
- "Specify a service QName in the service-ref declaration.");
+ "Specify a service QName in the <service-ref> declaration, or
thorugh the @WebServiceClient annotation.");
return sref;
}
Modified: branches/hbraun/trunk/integration/sunri/src/test/resources/test-excludes.txt
===================================================================
---
branches/hbraun/trunk/integration/sunri/src/test/resources/test-excludes.txt 2007-07-16
11:47:27 UTC (rev 3887)
+++
branches/hbraun/trunk/integration/sunri/src/test/resources/test-excludes.txt 2007-07-16
11:54:17 UTC (rev 3888)
@@ -19,4 +19,4 @@
# [JBWS-1674] Fix @WebServiceRef with SunRI
org/jboss/test/ws/jaxws/samples/retail/**
-org/jboss/test/ws/jaxws/samples/webserviceref/**
+#org/jboss/test/ws/jaxws/samples/webserviceref/**
Modified:
branches/hbraun/trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceRefBinderJAXRPC.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceRefBinderJAXRPC.java 2007-07-16
11:47:27 UTC (rev 3887)
+++
branches/hbraun/trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceRefBinderJAXRPC.java 2007-07-16
11:54:17 UTC (rev 3888)
@@ -44,11 +44,11 @@
{
// logging support
private static Logger log = Logger.getLogger(ServiceRefBinderJAXRPC.class);
-
+
/**
* Binds a Service into the callers ENC for every service-ref element
*/
- public void setupServiceRef(Context encCtx, String encName, AnnotatedElement
anElement, UnifiedServiceRefMetaData serviceRef)
+ public void setupServiceRef(Context encCtx, String encName, AnnotatedElement
anElement, UnifiedServiceRefMetaData serviceRef, ClassLoader loader)
throws NamingException
{
String externalName = encCtx.getNameInNamespace() + "/" + encName;
Modified:
branches/hbraun/trunk/testsuite/src/resources/jaxws/samples/webserviceref/META-INF/jboss-client.xml
===================================================================
---
branches/hbraun/trunk/testsuite/src/resources/jaxws/samples/webserviceref/META-INF/jboss-client.xml 2007-07-16
11:47:27 UTC (rev 3887)
+++
branches/hbraun/trunk/testsuite/src/resources/jaxws/samples/webserviceref/META-INF/jboss-client.xml 2007-07-16
11:54:17 UTC (rev 3888)
@@ -18,7 +18,8 @@
-->
<service-ref>
<service-ref-name>service2</service-ref-name>
- <wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+
<service-qname>{http://org.jboss.ws/wsref}TestEndpointService</service-qname>
+ <wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
<!--
@@ -26,6 +27,7 @@
-->
<service-ref>
<service-ref-name>TestEndpointService3</service-ref-name>
+
<service-qname>{http://org.jboss.ws/wsref}TestEndpointService</service-qname>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -34,6 +36,7 @@
-->
<service-ref>
<service-ref-name>org.jboss.test.ws.jaxws.samples.webserviceref.TestEndpointClientOne/service4</service-ref-name>
+
<service-qname>{http://org.jboss.ws/wsref}TestEndpointService</service-qname>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -42,6 +45,7 @@
-->
<service-ref>
<service-ref-name>TestEndpointService5</service-ref-name>
+
<service-qname>{http://org.jboss.ws/wsref}TestEndpointService</service-qname>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -50,6 +54,7 @@
-->
<service-ref>
<service-ref-name>org.jboss.test.ws.jaxws.samples.webserviceref.TestEndpointClientOne/service6</service-ref-name>
+
<service-qname>{http://org.jboss.ws/wsref}TestEndpointService</service-qname>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -58,6 +63,7 @@
-->
<service-ref>
<service-ref-name>port1</service-ref-name>
+
<service-qname>{http://org.jboss.ws/wsref}TestEndpointService</service-qname>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -66,6 +72,7 @@
-->
<service-ref>
<service-ref-name>Port2</service-ref-name>
+
<service-qname>{http://org.jboss.ws/wsref}TestEndpointService</service-qname>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -74,6 +81,7 @@
-->
<service-ref>
<service-ref-name>org.jboss.test.ws.jaxws.samples.webserviceref.TestEndpointClientOne/port3</service-ref-name>
+
<service-qname>{http://org.jboss.ws/wsref}TestEndpointService</service-qname>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -82,6 +90,7 @@
-->
<service-ref>
<service-ref-name>org.jboss.test.ws.jaxws.samples.webserviceref.TestEndpointClientOne/port4</service-ref-name>
+
<service-qname>{http://org.jboss.ws/wsref}TestEndpointService</service-qname>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -90,6 +99,7 @@
-->
<service-ref>
<service-ref-name>Port5</service-ref-name>
+
<service-qname>{http://org.jboss.ws/wsref}TestEndpointService</service-qname>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
Modified:
branches/hbraun/trunk/testsuite/src/resources/jaxws/samples/webserviceref/META-INF/jboss.xml
===================================================================
---
branches/hbraun/trunk/testsuite/src/resources/jaxws/samples/webserviceref/META-INF/jboss.xml 2007-07-16
11:47:27 UTC (rev 3887)
+++
branches/hbraun/trunk/testsuite/src/resources/jaxws/samples/webserviceref/META-INF/jboss.xml 2007-07-16
11:54:17 UTC (rev 3888)
@@ -24,6 +24,7 @@
-->
<service-ref>
<service-ref-name>service2</service-ref-name>
+
<service-qname>{http://org.jboss.ws/wsref}TestEndpointService</service-qname>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -32,6 +33,7 @@
-->
<service-ref>
<service-ref-name>TestEndpointService3</service-ref-name>
+
<service-qname>{http://org.jboss.ws/wsref}TestEndpointService</service-qname>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -40,6 +42,7 @@
-->
<service-ref>
<service-ref-name>org.jboss.test.ws.jaxws.samples.webserviceref.EJB3Client/service4</service-ref-name>
+
<service-qname>{http://org.jboss.ws/wsref}TestEndpointService</service-qname>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -48,6 +51,7 @@
-->
<service-ref>
<service-ref-name>TestEndpointService5</service-ref-name>
+
<service-qname>{http://org.jboss.ws/wsref}TestEndpointService</service-qname>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -56,6 +60,7 @@
-->
<service-ref>
<service-ref-name>org.jboss.test.ws.jaxws.samples.webserviceref.EJB3Client/service6</service-ref-name>
+
<service-qname>{http://org.jboss.ws/wsref}TestEndpointService</service-qname>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -64,6 +69,7 @@
-->
<service-ref>
<service-ref-name>port1</service-ref-name>
+
<service-qname>{http://org.jboss.ws/wsref}TestEndpointService</service-qname>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -72,6 +78,7 @@
-->
<service-ref>
<service-ref-name>Port2</service-ref-name>
+
<service-qname>{http://org.jboss.ws/wsref}TestEndpointService</service-qname>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -80,6 +87,7 @@
-->
<service-ref>
<service-ref-name>org.jboss.test.ws.jaxws.samples.webserviceref.EJB3Client/port3</service-ref-name>
+
<service-qname>{http://org.jboss.ws/wsref}TestEndpointService</service-qname>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
</session>
Modified:
branches/hbraun/trunk/testsuite/src/resources/jaxws/samples/webserviceref/META-INF-secure/jboss-client.xml
===================================================================
---
branches/hbraun/trunk/testsuite/src/resources/jaxws/samples/webserviceref/META-INF-secure/jboss-client.xml 2007-07-16
11:47:27 UTC (rev 3887)
+++
branches/hbraun/trunk/testsuite/src/resources/jaxws/samples/webserviceref/META-INF-secure/jboss-client.xml 2007-07-16
11:54:17 UTC (rev 3888)
@@ -26,6 +26,7 @@
<service-ref>
<service-ref-name>SecureService2</service-ref-name>
+
<service-qname>{http://org.jboss.ws/wsref}SecureEndpointService</service-qname>
<port-component-ref>
<port-qname>{http://org.jboss.ws/wsref}SecureEndpointPort</port-qname>
<stub-property>
@@ -42,6 +43,7 @@
<service-ref>
<service-ref-name>SecurePort1</service-ref-name>
+
<service-qname>{http://org.jboss.ws/wsref}SecureEndpointService</service-qname>
<port-component-ref>
<service-endpoint-interface>org.jboss.test.ws.jaxws.samples.webserviceref.SecureEndpoint</service-endpoint-interface>
<stub-property>