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 B1EF9D3FA for ; Wed, 3 Oct 2012 15:32:06 +0000 (UTC) Received: (qmail 48129 invoked by uid 500); 3 Oct 2012 15:32:06 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 48031 invoked by uid 500); 3 Oct 2012 15:32:06 -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 48024 invoked by uid 99); 3 Oct 2012 15:32:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Oct 2012 15:32:06 +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; Wed, 03 Oct 2012 15:32:05 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 10BAC2388900; Wed, 3 Oct 2012 15:31:22 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1393546 - /cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java Date: Wed, 03 Oct 2012 15:31:21 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121003153122.10BAC2388900@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Wed Oct 3 15:31:21 2012 New Revision: 1393546 URL: http://svn.apache.org/viewvc?rev=1393546&view=rev Log: Merged revisions 1392577 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/trunk ........ r1392577 | dkulp | 2012-10-01 16:37:15 -0400 (Mon, 01 Oct 2012) | 2 lines [CXF-4522] Update the soap:body content for SOAPMessage ........ Modified: cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java Modified: cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java?rev=1393546&r1=1393545&r2=1393546&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java (original) +++ cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java Wed Oct 3 15:31:21 2012 @@ -44,6 +44,8 @@ import org.w3c.dom.DocumentFragment; import org.w3c.dom.Element; import org.w3c.dom.Node; +import com.ibm.wsdl.util.xml.DOMUtils; + import org.apache.cxf.binding.soap.SoapMessage; import org.apache.cxf.binding.soap.saaj.SAAJFactoryResolver; import org.apache.cxf.binding.soap.saaj.SAAJUtils; @@ -52,8 +54,10 @@ import org.apache.cxf.common.logging.Log import org.apache.cxf.interceptor.Fault; import org.apache.cxf.io.CachedOutputStream; import org.apache.cxf.message.Message; +import org.apache.cxf.message.MessageUtils; import org.apache.cxf.message.XMLMessage; import org.apache.cxf.staxutils.StaxUtils; +import org.apache.cxf.staxutils.W3CDOMStreamReader; import org.apache.cxf.staxutils.W3CDOMStreamWriter; @@ -184,11 +188,29 @@ public class LogicalMessageImpl implemen return source; } - public void setPayload(Source s) { + public void setPayload(Source s) { Message message = msgContext.getWrappedMessage(); Service.Mode mode = (Service.Mode)msgContext.getWrappedMessage() .getContextualProperty(Service.Mode.class.getName()); - if (mode != null) { + SOAPMessage m = message.getContent(SOAPMessage.class); + if (m != null && !MessageUtils.isOutbound(message)) { + try { + SAAJUtils.getBody(m).removeContents(); + W3CDOMStreamWriter writer = new W3CDOMStreamWriter(SAAJUtils.getBody(m)); + StaxUtils.copy(s, writer); + writer.flush(); + writer.close(); + if (mode == Service.Mode.MESSAGE) { + s = new DOMSource(m.getSOAPPart()); + } else { + s = new DOMSource(SAAJUtils.getBody(m).getFirstChild()); + } + W3CDOMStreamReader r = new W3CDOMStreamReader(DOMUtils.getFirstChildElement(SAAJUtils.getBody(m))); + message.setContent(XMLStreamReader.class, r); + } catch (Exception e) { + throw new Fault(e); + } + } else if (mode != null) { if (message instanceof SoapMessage) { if (mode == Service.Mode.MESSAGE) { try {