Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 92126 invoked from network); 1 Jun 2009 19:45:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Jun 2009 19:45:38 -0000 Received: (qmail 65938 invoked by uid 500); 1 Jun 2009 19:45:51 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 65854 invoked by uid 500); 1 Jun 2009 19:45:50 -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 65845 invoked by uid 99); 1 Jun 2009 19:45:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Jun 2009 19:45:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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; Mon, 01 Jun 2009 19:45:47 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 92E04238886D; Mon, 1 Jun 2009 19:45:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r780800 - in /cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java systests/src/test/java/org/apache/cxf/systest/swa/ClientServerSwaTest.java Date: Mon, 01 Jun 2009 19:45:26 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090601194526.92E04238886D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Mon Jun 1 19:45:26 2009 New Revision: 780800 URL: http://svn.apache.org/viewvc?rev=780800&view=rev Log: [CXF-2250] Fix issue of .INBOUND_MESSAGE_ATTACHMENTS not being mapped correctly on the client side. Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java cxf/trunk/systests/src/test/java/org/apache/cxf/systest/swa/ClientServerSwaTest.java Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java?rev=780800&r1=780799&r2=780800&view=diff ============================================================================== --- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java (original) +++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java Mon Jun 1 19:45:26 2009 @@ -204,13 +204,22 @@ } } if (MessageContext.INBOUND_MESSAGE_ATTACHMENTS.equals(key)) { - if (isOutbound()) { - ret = reqMessage.get(key); + if (isRequestor() && isOutbound()) { + ret = null; + } else if (isOutbound()) { + ret = createAttachments(reqMessage, + MessageContext.INBOUND_MESSAGE_ATTACHMENTS); + } else { + ret = createAttachments(message, + MessageContext.INBOUND_MESSAGE_ATTACHMENTS); } - ret = createAttachments(getWrappedMessage(), MessageContext.INBOUND_MESSAGE_ATTACHMENTS); } else if (MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS.equals(key)) { - ret = createAttachments(isRequestor() ? getWrappedMessage() : createResponseMessage(), - MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS); + if (isRequestor() && !isOutbound()) { + ret = createAttachments(reqMessage, MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS); + } else { + ret = createAttachments(isRequestor() ? getWrappedMessage() : createResponseMessage(), + MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS); + } } else if (MessageContext.MESSAGE_OUTBOUND_PROPERTY.equals(key)) { ret = isOutbound(); } else if (MessageContext.HTTP_REQUEST_HEADERS.equals(key)) { @@ -283,11 +292,11 @@ } return m; } - private Object createAttachments(Message mc, String propertyName) { + private Object createAttachments(Map mc, String propertyName) { if (mc == null) { return null; } - Collection attachments = mc.getAttachments(); + Collection attachments = CastUtils.cast((Collection)mc.get(Message.ATTACHMENTS)); Map dataHandlers = AttachmentUtil.getDHMap(attachments); mc.put(propertyName, Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/swa/ClientServerSwaTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/swa/ClientServerSwaTest.java?rev=780800&r1=780799&r2=780800&view=diff ============================================================================== --- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/swa/ClientServerSwaTest.java (original) +++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/swa/ClientServerSwaTest.java Mon Jun 1 19:45:26 2009 @@ -21,6 +21,7 @@ import java.awt.Image; import java.io.InputStream; import java.net.URL; +import java.util.Map; import javax.activation.DataHandler; import javax.imageio.ImageIO; @@ -32,10 +33,13 @@ import javax.xml.soap.SOAPMessage; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; +import javax.xml.ws.BindingProvider; import javax.xml.ws.Dispatch; import javax.xml.ws.Holder; import javax.xml.ws.Service; +import javax.xml.ws.handler.MessageContext; +import org.apache.cxf.helpers.CastUtils; import org.apache.cxf.helpers.IOUtils; import org.apache.cxf.swa.SwAService; import org.apache.cxf.swa.SwAServiceInterface; @@ -218,7 +222,12 @@ VoidRequest request = new VoidRequest(); OutputResponseAll response = port.echoAllAttachmentTypes(request, attach1, attach2, attach3, attach4, attach5); + assertNotNull(response); + Map map = CastUtils.cast((Map)((BindingProvider)port).getResponseContext() + .get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS)); + assertNotNull(map); + assertEquals(5, map.size()); } @Test