Author: jliu
Date: Wed Nov 21 00:27:12 2007
New Revision: 596982
URL: http://svn.apache.org/viewvc?rev=596982&view=rev
Log:
Add support for Provider.readEndpointReference(Source infoset).
Modified:
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/Messages.properties
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/EndpointReferenceTest.java
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/resources/hello_world_soap_http_infoset.xml
Modified:
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/Messages.properties
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/Messages.properties?rev=596982&r1=596981&r2=596982&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/Messages.properties
(original)
+++
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/Messages.properties
Wed Nov 21 00:27:12 2007
@@ -20,3 +20,5 @@
#
INVALID_IMPLEMENTOR_EXC = Cannot create Endpoint for implementor that does not
have a WebService annotation and does not implement the Provider interface
ENDPOINT_CREATION_FAILED_MSG = Failed to create endpoint
+JAXBCONTEXT_CREATION_FAILED = Failed to create JAXBContext for
W3CEndpointReference.
+ERROR_UNMARSHAL_ENDPOINTREFERENCE = Failed to unmarshal EndpointReference from
inforset.
Modified:
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java?rev=596982&r1=596981&r2=596982&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
(original)
+++
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
Wed Nov 21 00:27:12 2007
@@ -22,6 +22,10 @@
import java.net.URL;
import java.util.List;
import java.util.logging.Logger;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
import javax.xml.namespace.QName;
import javax.xml.transform.Source;
import javax.xml.ws.Endpoint;
@@ -46,6 +50,8 @@
public static final String JAXWS_PROVIDER = ProviderImpl.class.getName();
private static final Logger LOG =
LogUtils.getL7dLogger(ProviderImpl.class);
+
+ private static JAXBContext jaxbContext;
@Override
public ServiceDelegate createServiceDelegate(URL url,
@@ -93,7 +99,24 @@
}
public EndpointReference readEndpointReference(Source eprInfoset) {
- throw new UnsupportedOperationException();
+ try {
+ Unmarshaller unmarshaller = getJAXBContext().createUnmarshaller();
+ return (EndpointReference)unmarshaller.unmarshal(eprInfoset);
+ } catch (JAXBException e) {
+ throw new WebServiceException(
+ new Message("ERROR_UNMARSHAL_ENDPOINTREFERENCE",
LOG).toString(), e);
+ }
+ }
+
+ private JAXBContext getJAXBContext() {
+ if (jaxbContext == null) {
+ try {
+ jaxbContext =
JAXBContext.newInstance(W3CEndpointReference.class);
+ } catch (JAXBException e) {
+ throw new WebServiceException(new
Message("JAXBCONTEXT_CREATION_FAILED", LOG).toString(), e);
+ }
+ }
+ return jaxbContext;
}
}
Modified:
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/EndpointReferenceTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/EndpointReferenceTest.java?rev=596982&r1=596981&r2=596982&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/EndpointReferenceTest.java
(original)
+++
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/EndpointReferenceTest.java
Wed Nov 21 00:27:12 2007
@@ -249,7 +249,6 @@
}
@Test
- @Ignore("Not implemented yet")
public void testProviderReadEndpointReference() throws Exception {
ProviderImpl provider = new ProviderImpl();
Modified:
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/resources/hello_world_soap_http_infoset.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/resources/hello_world_soap_http_infoset.xml?rev=596982&r1=596981&r2=596982&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/resources/hello_world_soap_http_infoset.xml
(original)
+++
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/resources/hello_world_soap_http_infoset.xml
Wed Nov 21 00:27:12 2007
@@ -1,9 +1,8 @@
-<wsa:EndpointReference>
+<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Address>http://localhost:8080/test</wsa:Address>
<wsa:ReferenceProperties></wsa:ReferenceProperties>
<wsa:ReferenceParameters></wsa:ReferenceParameters>
<wsa:PortType></wsa:PortType>
<wsa:ServiceName></wsa:ServiceName>
<wsa:Policies></wsa:Policies>
- <xs:any/>
</wsa:EndpointReference>