Author: alessio.soldano(a)jboss.com
Date: 2009-01-14 07:39:11 -0500 (Wed, 14 Jan 2009)
New Revision: 9026
Modified:
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java
stack/native/branches/jaxws21/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/epr/EndpointReferenceTestCase.java
Log:
[JBWS-2452] Implementing Provider.readEndpointReference(...)
Modified:
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java
===================================================================
---
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java 2009-01-13
18:25:02 UTC (rev 9025)
+++
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java 2009-01-14
12:39:11 UTC (rev 9026)
@@ -30,6 +30,7 @@
import javax.xml.ws.Endpoint;
import javax.xml.ws.EndpointReference;
import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceFeature;
import javax.xml.ws.soap.SOAPBinding;
import javax.xml.ws.spi.Provider;
@@ -37,7 +38,6 @@
import javax.xml.ws.wsaddressing.W3CEndpointReference;
import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
-import org.jboss.util.NotImplementedException;
import org.jboss.wsf.common.DOMUtils;
import org.w3c.dom.Element;
@@ -139,6 +139,16 @@
@Override
public EndpointReference readEndpointReference(Source eprInfoset)
{
- throw new NotImplementedException();
+ if (eprInfoset == null)
+ throw new NullPointerException("Provided eprInfoset cannot be null");
+ try
+ {
+ //we currently support W3CEndpointReference only
+ return new W3CEndpointReference(eprInfoset);
+ }
+ catch (Exception e)
+ {
+ throw new WebServiceException(e);
+ }
}
}
Modified:
stack/native/branches/jaxws21/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/epr/EndpointReferenceTestCase.java
===================================================================
---
stack/native/branches/jaxws21/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/epr/EndpointReferenceTestCase.java 2009-01-13
18:25:02 UTC (rev 9025)
+++
stack/native/branches/jaxws21/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/epr/EndpointReferenceTestCase.java 2009-01-14
12:39:11 UTC (rev 9026)
@@ -24,6 +24,9 @@
import java.net.URL;
import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.EndpointReference;
import javax.xml.ws.Service;
import javax.xml.ws.wsaddressing.W3CEndpointReference;
import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
@@ -80,4 +83,29 @@
String retStr = port.echo("hello");
assertEquals("hello|123456789|ABCDEFG", retStr);
}
+
+ public void testEndpointReferenceFromSource() throws Exception
+ {
+ String address = "http://" + getServerHost() +
":8080/jaxws-epr/TestEndpointImpl";
+ URL wsdlURL = new URL(address + "?wsdl");
+ QName serviceName = new QName("http://org.jboss.ws/epr",
"TestEndpointService");
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("<EndpointReference
xmlns=\"http://www.w3.org/2005/08/addressing\">");
+
sb.append("<Address>").append(address).append("</Address>");
+
sb.append("<ServiceName>").append(serviceName).append("</ServiceName>");
+ sb.append("<ReferenceParameters>");
+ sb.append("<fabrikam:CustomerKey
xmlns:fabrikam='http://example.com/fabrikam'>123456789</fab...);
+ sb.append("<fabrikam:ShoppingCart
xmlns:fabrikam='http://example.com/fabrikam'>ABCDEFG</fabri...);
+ sb.append("</ReferenceParameters>");
+ sb.append("</EndpointReference>");
+ Source eprInfoset = new StreamSource(new java.io.StringReader(sb.toString()));
+ EndpointReference epr = EndpointReference.readFrom(eprInfoset);
+
+ Service service = Service.create(wsdlURL, serviceName);
+ TestEndpoint port = service.getPort(epr, TestEndpoint.class);
+ ((StubExt)port).setConfigName("Standard WSAddressing Client");
+ String retStr = port.echo("hello");
+ assertEquals("hello|123456789|ABCDEFG", retStr);
+ }
}