cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
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 GMT
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 {



Mime
View raw message