Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 72C079A3A for ; Fri, 23 Mar 2012 17:08:23 +0000 (UTC) Received: (qmail 66753 invoked by uid 500); 23 Mar 2012 17:08:23 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 66655 invoked by uid 500); 23 Mar 2012 17:08:23 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 66640 invoked by uid 99); 23 Mar 2012 17:08:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Mar 2012 17:08:23 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Mar 2012 17:08:17 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 3FCD323888EA; Fri, 23 Mar 2012 17:07:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1304487 - in /cxf/branches/2.5.x-fixes: rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/ systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/ systests/ws-specs... Date: Fri, 23 Mar 2012 17:07:56 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120323170757.3FCD323888EA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Fri Mar 23 17:07:56 2012 New Revision: 1304487 URL: http://svn.apache.org/viewvc?rev=1304487&view=rev Log: [CXF-4189] Fix problem with ReplyTo=None for req/resp mep Patch from Andrei Shakirin applied Conflicts: api/src/main/java/org/apache/cxf/ws/addressing/Messages.properties Modified: cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties cxf/branches/2.5.x-fixes/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAClientServerTest.java cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyTest.java Modified: cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java?rev=1304487&r1=1304486&r2=1304487&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java (original) +++ cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java Fri Mar 23 17:07:56 2012 @@ -518,10 +518,14 @@ public class MAPAggregator extends Abstr } AddressingPropertiesImpl theMaps = ContextUtils.retrieveMAPs(message, false, ContextUtils.isOutbound(message)); - if (null != theMaps && ContextUtils.isRequestor(message)) { - assertAddressing(message, - theMaps.getReplyTo(), - theMaps.getFaultTo()); + if (null != theMaps) { + if (ContextUtils.isRequestor(message)) { + assertAddressing(message, + theMaps.getReplyTo(), + theMaps.getFaultTo()); + } else { + checkReplyTo(message, theMaps); + } } } else if (!ContextUtils.isRequestor(message)) { //responder validates incoming MAPs @@ -552,10 +556,8 @@ public class MAPAggregator extends Abstr message); } if (!isOneway) { - // if ReplyTo address is none then 202 response status is expected - // However returning a fault is more appropriate for request-response MEP if (ContextUtils.isNoneAddress(maps.getReplyTo())) { - continueProcessing = false; + LOG.warning("Detected NONE value in ReplyTo WSA header for request-respone MEP"); } else { // ensure the inbound MAPs are available in both the full & fault // response messages (used to determine relatesTo etc.) @@ -1265,5 +1267,24 @@ public class MAPAggregator extends Abstr return valid; } + + /** + * Check for NONE ReplyTo value in request-response MEP + * @param message the current message + * @param maps the incoming MAPs + */ + private void checkReplyTo(Message message, AddressingProperties maps) { + // if ReplyTo address is none then 202 response status is expected + // However returning a fault is more appropriate for request-response MEP + if (!message.getExchange().isOneWay() + && !MessageUtils.isPartialResponse(message) + && ContextUtils.isNoneAddress(maps.getReplyTo())) { + String reason = MessageFormat.format(BUNDLE.getString("REPLYTO_NOT_SUPPORTED_MSG"), + maps.getReplyTo().getAddress().getValue()); + throw new SoapFault(reason, + new QName(Names.WSA_NAMESPACE_NAME, + Names.WSA_NONE_ADDRESS)); + } + } } Modified: cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties?rev=1304487&r1=1304486&r2=1304487&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties (original) +++ cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties Fri Mar 23 17:07:56 2012 @@ -26,4 +26,6 @@ INVALID_MAP_MSG = Invalid Message Addres MAP_REQUIRED_MSG = Message Addressing Property {0} required DUPLICATE_MESSAGE_ID_MSG = Duplicate Message ID {0} INVALID_ADDRESSING_PROPERTY_MESSAGE = A header representing a Message Addressing Property is not valid and the message cannot be processed -MISSING_ACTION_MESSAGE = A required header representing a Message Addressing Property is not present \ No newline at end of file +MISSING_ACTION_MESSAGE = A required header representing a Message Addressing Property is not present +UNSUPPORTED_REPLY_TO_VALUE = A value of ReplyTo property {0} is not supported for request-response MEP +REPLYTO_NOT_SUPPORTED_MSG = ReplyTo {0} is not supported for request-response MEP Modified: cxf/branches/2.5.x-fixes/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java?rev=1304487&r1=1304486&r2=1304487&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java (original) +++ cxf/branches/2.5.x-fixes/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java Fri Mar 23 17:07:56 2012 @@ -56,12 +56,10 @@ import org.apache.cxf.service.model.Inte import org.apache.cxf.service.model.MessageInfo.Type; import org.apache.cxf.service.model.OperationInfo; import org.apache.cxf.service.model.ServiceInfo; - import org.apache.cxf.transport.Conduit; import org.apache.cxf.transport.Destination; import org.easymock.EasyMock; import org.easymock.IMocksControl; - import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -383,10 +381,11 @@ public class MAPAggregatorTest extends A verifyMessage(message, true, false, false /*check*/); } - @Test + @Test(expected = SoapFault.class) public void testTwoWayRequestWithReplyToNone() throws Exception { Message message = new MessageImpl(); Exchange exchange = new ExchangeImpl(); + exchange.setOutMessage(message); message.setExchange(exchange); setUpMessageProperty(message, REQUESTOR_ROLE, @@ -400,18 +399,13 @@ public class MAPAggregatorTest extends A maps.setMessageID(id); maps.setAction(ContextUtils.getAttributedURI("")); setUpMessageProperty(message, - SERVER_ADDRESSING_PROPERTIES_INBOUND, + SERVER_ADDRESSING_PROPERTIES_OUTBOUND, maps); setUpMessageProperty(message, "org.apache.cxf.ws.addressing.map.fault.name", "NoneAddress"); - try { - aggregator.mediate(message, false); - fail("Two way request with ReplyTo address set to none must fail"); - } catch (SoapFault ex) { - // expected - } + aggregator.mediate(message, false); } @Test Modified: cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAClientServerTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAClientServerTest.java?rev=1304487&r1=1304486&r2=1304487&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAClientServerTest.java (original) +++ cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAClientServerTest.java Fri Mar 23 17:07:56 2012 @@ -53,7 +53,7 @@ public class WSAClientServerTest extends @BeforeClass public static void startServers() throws Exception { - assertTrue("server did not launch correctly", launchServer(Server.class)); + assertTrue("server did not launch correctly", launchServer(Server.class, true)); } @Test Modified: cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyTest.java?rev=1304487&r1=1304486&r2=1304487&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyTest.java (original) +++ cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyTest.java Fri Mar 23 17:07:56 2012 @@ -58,6 +58,9 @@ public class AddressingPolicyTest extend public Server(String dir) { tmpDir = dir; } + public Server(String[] args) { + tmpDir = args[0]; + } protected void run() { System.setProperty("temp.location", tmpDir); @@ -97,7 +100,7 @@ public class AddressingPolicyTest extend System.setProperty("temp.location", TEMPDIR); assertTrue("server did not launch correctly", launchServer(Server.class, null, - new String[] {TEMPDIR})); + new String[] {TEMPDIR}, true)); } @Test @@ -120,7 +123,7 @@ public class AddressingPolicyTest extend // oneway - greeter.greetMeOneWay("CXF"); + //greeter.greetMeOneWay("CXF"); // two-way