You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2009/05/07 21:04:32 UTC
svn commit: r772745 - in /cxf/trunk:
common/common/src/main/java/org/apache/cxf/staxutils/
rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/
rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/
systests/src/test/java/org/apache/cxf/systest/j...
Author: dkulp
Date: Thu May 7 19:04:27 2009
New Revision: 772745
URL: http://svn.apache.org/viewvc?rev=772745&view=rev
Log:
[CXF-2190] When using the Dispatch clients, all processing has to "assume" doc/lit/unwrapped symantics as, by definition, you are dealing with the payload, not the individual parts and such that RPC expects.
Modified:
cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CNamespaceContext.java
cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java
Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CNamespaceContext.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CNamespaceContext.java?rev=772745&r1=772744&r2=772745&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CNamespaceContext.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CNamespaceContext.java Thu May 7 19:04:27 2009
@@ -32,7 +32,12 @@
public class W3CNamespaceContext implements NamespaceContext {
private Element currentNode;
-
+
+ public W3CNamespaceContext() {
+ }
+ public W3CNamespaceContext(Element el) {
+ currentNode = el;
+ }
public String getNamespaceURI(String prefix) {
String name = prefix;
if (name.length() == 0) {
Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java?rev=772745&r1=772744&r2=772745&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java (original)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java Thu May 7 19:04:27 2009
@@ -337,6 +337,13 @@
hasWrapped = true;
}
}
+
+ if (Boolean.TRUE.equals(binding.getService().getProperty("soap.force.doclit.bare"))) {
+ hasDoc = true;
+ hasRPC = false;
+ parameterStyle = SoapBindingConstants.PARAMETER_STYLE_BARE;
+ bindingStyle = SoapBindingConstants.BINDING_STYLE_DOC;
+ }
if (hasRPC && hasDoc) {
throw new RuntimeException("WSI-BP prohibits RPC and Document style "
+ "operations in same service.");
Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?rev=772745&r1=772744&r2=772745&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java Thu May 7 19:04:27 2009
@@ -272,6 +272,9 @@
serviceFactory = sf;
}
configureObject(dispatchService);
+ for (ServiceInfo si : dispatchService.getServiceInfos()) {
+ si.setProperty("soap.force.doclit.bare", Boolean.TRUE);
+ }
return serviceFactory;
}
Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java?rev=772745&r1=772744&r2=772745&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java Thu May 7 19:04:27 2009
@@ -20,6 +20,7 @@
package org.apache.cxf.systest.jaxws;
import java.io.InputStream;
+import java.io.StringReader;
import java.lang.reflect.UndeclaredThrowableException;
import java.net.HttpURLConnection;
import java.util.HashMap;
@@ -36,15 +37,21 @@
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.Dispatch;
import javax.xml.ws.Endpoint;
import javax.xml.xpath.XPathConstants;
import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.apache.cxf.binding.soap.Soap11;
import org.apache.cxf.helpers.XMLUtils;
import org.apache.cxf.helpers.XPathUtils;
+import org.apache.cxf.staxutils.W3CNamespaceContext;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
import org.apache.hello_world_rpclit.GreeterRPCLit;
@@ -112,7 +119,28 @@
throw (Exception)ex.getCause();
}
}
-
+
+ @Test
+ public void testDispatchClient() throws Exception {
+ SOAPServiceRPCLit service = new SOAPServiceRPCLit();
+ Dispatch<Source> disp = service.createDispatch(portName, Source.class,
+ javax.xml.ws.Service.Mode.PAYLOAD);
+
+ String req = "<ns1:sendReceiveData xmlns:ns1=\"http://apache.org/hello_world_rpclit\">"
+ + "<in xmlns:ns2=\"http://apache.org/hello_world_rpclit/types\">"
+ + "<ns2:elem1>elem1</ns2:elem1><ns2:elem2>elem2</ns2:elem2><ns2:elem3>45</ns2:elem3>"
+ + "</in></ns1:sendReceiveData>";
+ Source source = new StreamSource(new StringReader(req));
+ Source resp = disp.invoke(source);
+ assertNotNull(resp);
+
+ Node nd = XMLUtils.fromSource(resp);
+ if (nd instanceof Document) {
+ nd = ((Document)nd).getDocumentElement();
+ }
+ XPathUtils xpu = new XPathUtils(new W3CNamespaceContext((Element)nd));
+ assertTrue(xpu.isExist("/ns1:sendReceiveDataResponse/out", nd, XPathConstants.NODE));
+ }
@Test
public void testComplexType() throws Exception {
SOAPServiceRPCLit service = new SOAPServiceRPCLit();