cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ashaki...@apache.org
Subject svn commit: r1561021 - in /cxf/branches/2.7.x-fixes: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/AbstractJAXWSMethodInvoker.java systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
Date Fri, 24 Jan 2014 14:18:29 GMT
Author: ashakirin
Date: Fri Jan 24 14:18:29 2014
New Revision: 1561021

URL: http://svn.apache.org/r1561021
Log:
Backported [CXF-5516]: decoupled endpoints is not compatible with @UseAsyncMethod annotation

Modified:
    cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/AbstractJAXWSMethodInvoker.java
    cxf/branches/2.7.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/AbstractJAXWSMethodInvoker.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/AbstractJAXWSMethodInvoker.java?rev=1561021&r1=1561020&r2=1561021&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/AbstractJAXWSMethodInvoker.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/AbstractJAXWSMethodInvoker.java
Fri Jan 24 14:18:29 2014
@@ -55,6 +55,7 @@ import org.apache.cxf.message.FaultMode;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageContentsList;
 import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.service.factory.ServiceConstructionException;
 import org.apache.cxf.service.invoker.Factory;
 import org.apache.cxf.service.invoker.FactoryInvoker;
@@ -63,6 +64,8 @@ import org.apache.cxf.service.model.Bind
 
 public abstract class AbstractJAXWSMethodInvoker extends FactoryInvoker {
     private static final String ASYNC_METHOD = "org.apache.cxf.jaxws.async.method";
+    private static final String PARTIAL_RESPONSE_SENT_PROPERTY =
+        "org.apache.cxf.ws.addressing.partial.response.sent";
 
     public AbstractJAXWSMethodInvoker(final Object bean) {
         super(new SingletonFactory(bean));
@@ -110,7 +113,10 @@ public abstract class AbstractJAXWSMetho
                     return ret; 
                 }
                 ContinuationProvider cp = ex.getInMessage().get(ContinuationProvider.class);
-                if (cp == null && uam.always()) {
+                // Check for decoupled endpoints: if partial response already was sent, ignore
continuation
+                boolean decoupledEndpoints = MessageUtils
+                    .getContextualBoolean(ex.getInMessage(), PARTIAL_RESPONSE_SENT_PROPERTY,
false);
+                if ((cp == null) && uam.always() || decoupledEndpoints) {
                     JaxwsServerHandler handler = new JaxwsServerHandler(null);
                     ex.put(JaxwsServerHandler.class, handler);
                     params.add(handler);

Modified: cxf/branches/2.7.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?rev=1561021&r1=1561020&r2=1561021&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
(original)
+++ cxf/branches/2.7.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
Fri Jan 24 14:18:29 2014
@@ -54,7 +54,6 @@ import javax.xml.xpath.XPathConstants;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
-
 import org.apache.cxf.Bus;
 import org.apache.cxf.binding.soap.Soap11;
 import org.apache.cxf.bus.CXFBusFactory;
@@ -65,10 +64,12 @@ import org.apache.cxf.endpoint.dynamic.D
 import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.helpers.XPathUtils;
+import org.apache.cxf.jaxws.DispatchImpl;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.transport.http.HTTPConduit;
+import org.apache.cxf.ws.addressing.WSAddressingFeature;
 import org.apache.hello_world_soap_http.BadRecordLitFault;
 import org.apache.hello_world_soap_http.DocLitBare;
 import org.apache.hello_world_soap_http.Greeter;
@@ -90,6 +91,7 @@ public class ClientServerTest extends Ab
 
     static final String BOGUS_PORT = allocatePort(Server.class, 3);
     static final String PUB_PORT = allocatePort(Server.class, 4);
+    static final String CLIENT_PORT = allocatePort(Server.class, 5);
     
     
 
@@ -1075,4 +1077,27 @@ public class ClientServerTest extends Ab
 
         assertEquals(requestString, StaxUtils.toString(response));
     }
+
+    @Test
+    public void testEchoProviderAsyncDecoupledEndpoints() throws Exception {
+        String requestString = "<echo/>";
+        Service service = Service.create(serviceName);
+        service.addPort(fakePortName, javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING,
+                        "http://localhost:" + PORT + "/SoapContext/AsyncEchoProvider");
+        Dispatch<StreamSource> dispatcher = service.createDispatch(fakePortName,
+                                                                   StreamSource.class,
+                                                                   Service.Mode.PAYLOAD);
+
+        Client client = ((DispatchImpl<StreamSource>)dispatcher).getClient();
+        WSAddressingFeature wsAddressingFeature = new WSAddressingFeature();
+        wsAddressingFeature.initialize(client, client.getBus());
+        dispatcher.getRequestContext().put("org.apache.cxf.ws.addressing.replyto",
+                                           "http://localhost:" + CLIENT_PORT
+                                               + "/SoapContext/AsyncEchoClient");
+
+        StreamSource request = new StreamSource(new ByteArrayInputStream(requestString.getBytes()));
+        StreamSource response = dispatcher.invoke(request);
+
+        assertEquals(requestString, StaxUtils.toString(response));
+    }
 }



Mime
View raw message