You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by as...@apache.org on 2014/01/24 14:36:34 UTC
svn commit: r1560997 - in /cxf/trunk:
rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/AbstractJAXWSMethodInvoker.java
systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
Author: ashakirin
Date: Fri Jan 24 13:36:33 2014
New Revision: 1560997
URL: http://svn.apache.org/r1560997
Log:
Fixed [CXF-5516]: decoupled endpoints is not compatible with @UseAsyncMethod annotation
Modified:
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/AbstractJAXWSMethodInvoker.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/AbstractJAXWSMethodInvoker.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/AbstractJAXWSMethodInvoker.java?rev=1560997&r1=1560996&r2=1560997&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/AbstractJAXWSMethodInvoker.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/AbstractJAXWSMethodInvoker.java Fri Jan 24 13:36:33 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/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?rev=1560997&r1=1560996&r2=1560997&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java Fri Jan 24 13:36:33 2014
@@ -59,10 +59,12 @@ import org.apache.cxf.configuration.secu
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.endpoint.dynamic.DynamicClientFactory;
import org.apache.cxf.frontend.ClientProxy;
+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;
@@ -84,6 +86,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);
@@ -977,4 +980,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));
+ }
}