Author: dkulp Date: Thu Dec 12 18:36:35 2013 New Revision: 1550475 URL: http://svn.apache.org/r1550475 Log: Merged revisions 1549941 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes
........ r1549941 | dkulp | 2013-12-10 14:22:20 -0500 (Tue, 10 Dec 2013) | 10 lines Merged revisions 1548739 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/trunk ........ r1548739 | dkulp | 2013-12-06 17:41:09 -0500 (Fri, 06 Dec 2013) | 2 lines [CXF-5434] Fix some issues where a reply may attempt to be sent to the "none" address. ........ ........ Modified: cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java cxf/branches/2.6.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSOutputStream.java cxf/branches/2.6.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java cxf/branches/2.6.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/GreeterImplQueueOneWay.java cxf/branches/2.6.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java Modified: cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java?rev=1550475&r1=1550474&r2=1550475&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java (original) +++ cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java Thu Dec 12 18:36:35 2013 @@ -62,6 +62,9 @@ public class RPCOutInterceptor extends A boolean output = false; if (!isRequestor(message)) { + if (operation.getOutput() == null) { + return; + } parts = operation.getOutput().getMessageParts(); output = true; } else { Modified: cxf/branches/2.6.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSOutputStream.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSOutputStream.java?rev=1550475&r1=1550474&r2=1550475&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSOutputStream.java (original) +++ cxf/branches/2.6.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSOutputStream.java Thu Dec 12 18:36:35 2013 @@ -76,7 +76,11 @@ class JMSOutputStream extends CachedOutp throw new IOException("Error creating request Object from Message content, exception " + ex); } if (LOG.isLoggable(Level.FINE)) { - LOG.log(Level.FINE, "Payload to be sent out is :[" + request + "]"); + Object o = request; + if (o instanceof byte[]) { + o = new String((byte[])o, "utf-8"); + } + LOG.log(Level.FINE, "Payload to be sent out is :[" + o + "]"); } return request; } Modified: cxf/branches/2.6.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java?rev=1550475&r1=1550474&r2=1550475&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java (original) +++ cxf/branches/2.6.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java Thu Dec 12 18:36:35 2013 @@ -74,6 +74,64 @@ import org.apache.cxf.wsdl.EndpointRefer * Holder for utility methods relating to contexts. */ final class InternalContextUtils { + private static final class DecoupledDestination implements Destination { + private final EndpointInfo ei; + private final EndpointReferenceType reference; + + private DecoupledDestination(EndpointInfo ei, EndpointReferenceType reference) { + this.ei = ei; + this.reference = reference; + } + + public EndpointReferenceType getAddress() { + return reference; + } + + public Conduit getBackChannel(Message inMessage, + Message partialResponse, + EndpointReferenceType address) + throws IOException { + if (ContextUtils.isNoneAddress(reference)) { + return null; + } + Bus bus = inMessage.getExchange().get(Bus.class); + //this is a response targeting a decoupled endpoint. Treat it as a oneway so + //we don't wait for a response. + inMessage.getExchange().setOneWay(true); + ConduitInitiator conduitInitiator + = bus.getExtension(ConduitInitiatorManager.class) + .getConduitInitiatorForUri(reference.getAddress().getValue()); + if (conduitInitiator != null) { + Conduit c = conduitInitiator.getConduit(ei, reference); + // ensure decoupled back channel input stream is closed + c.setMessageObserver(new MessageObserver() { + public void onMessage(Message m) { + InputStream is = m.getContent(InputStream.class); + if (is != null) { + try { + is.close(); + } catch (Exception e) { + // ignore + } + } + } + }); + return c; + } + return null; + } + + public MessageObserver getMessageObserver() { + return null; + } + + public void shutdown() { + } + + public void setMessageObserver(MessageObserver observer) { + } + } + private static final Logger LOG = LogUtils.getL7dLogger(InternalContextUtils.class); /** @@ -287,48 +345,8 @@ final class InternalContextUtils { public static Destination createDecoupledDestination( Exchange exchange, final EndpointReferenceType reference) { - final EndpointInfo ei = exchange.get(Endpoint.class).getEndpointInfo(); - return new Destination() { - public EndpointReferenceType getAddress() { - return reference; - } - public Conduit getBackChannel(Message inMessage, Message partialResponse, - EndpointReferenceType address) throws IOException { - Bus bus = inMessage.getExchange().get(Bus.class); - //this is a response targeting a decoupled endpoint. Treat it as a oneway so - //we don't wait for a response. - inMessage.getExchange().setOneWay(true); - ConduitInitiator conduitInitiator - = bus.getExtension(ConduitInitiatorManager.class) - .getConduitInitiatorForUri(reference.getAddress().getValue()); - if (conduitInitiator != null) { - Conduit c = conduitInitiator.getConduit(ei, reference); - // ensure decoupled back channel input stream is closed - c.setMessageObserver(new MessageObserver() { - public void onMessage(Message m) { - InputStream is = m.getContent(InputStream.class); - if (is != null) { - try { - is.close(); - } catch (Exception e) { - // ignore - } - } - } - }); - return c; - } - return null; - } - public MessageObserver getMessageObserver() { - return null; - } - public void shutdown() { - } - public void setMessageObserver(MessageObserver observer) { - } - }; + return new DecoupledDestination(ei, reference); } /** Modified: cxf/branches/2.6.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/GreeterImplQueueOneWay.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/GreeterImplQueueOneWay.java?rev=1550475&r1=1550474&r2=1550475&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/GreeterImplQueueOneWay.java (original) +++ cxf/branches/2.6.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/GreeterImplQueueOneWay.java Thu Dec 12 18:36:35 2013 @@ -19,6 +19,7 @@ package org.apache.cxf.systest.jms; import javax.jws.WebService; +import javax.xml.ws.soap.Addressing; import org.apache.cxf.hello_world_jms.HelloWorldOneWayPort; @@ -29,6 +30,7 @@ import org.apache.cxf.hello_world_jms.He endpointInterface = "org.apache.cxf.hello_world_jms.HelloWorldOneWayPort", targetNamespace = "http://cxf.apache.org/hello_world_jms", wsdlLocation = "testutils/jms_test.wsdl") +@Addressing(required = true) public class GreeterImplQueueOneWay implements HelloWorldOneWayPort { public void greetMeOneWay(String stringParam0) { Modified: cxf/branches/2.6.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java?rev=1550475&r1=1550474&r2=1550475&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java (original) +++ cxf/branches/2.6.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java Thu Dec 12 18:36:35 2013 @@ -40,10 +40,10 @@ import javax.xml.ws.BindingProvider; import javax.xml.ws.Endpoint; import javax.xml.ws.Holder; import javax.xml.ws.Response; +import javax.xml.ws.soap.AddressingFeature; import javax.xml.ws.soap.SOAPBinding; import javax.xml.ws.soap.SOAPFaultException; - import org.apache.cxf.Bus; import org.apache.cxf.BusFactory; import org.apache.cxf.binding.soap.interceptor.TibcoSoapActionInterceptor; @@ -93,6 +93,7 @@ import org.apache.hello_world_doc_lit.Gr import org.apache.hello_world_doc_lit.PingMeFault; import org.apache.hello_world_doc_lit.SOAPService2; import org.apache.hello_world_doc_lit.SOAPService7; + import org.junit.BeforeClass; import org.junit.Test; @@ -541,7 +542,8 @@ public class JMSClientServerTest extends assertNotNull(service); try { - HelloWorldOneWayPort greeter = service.getPort(portName, HelloWorldOneWayPort.class); + HelloWorldOneWayPort greeter = service.getPort(portName, HelloWorldOneWayPort.class, + new AddressingFeature(true, true)); for (int idx = 0; idx < 5; idx++) { greeter.greetMeOneWay("JMS:Queue:Milestone-" + idx); }
