cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1399983 - /cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
Date Fri, 19 Oct 2012 07:02:16 GMT
Author: ffang
Date: Fri Oct 19 07:02:16 2012
New Revision: 1399983

URL: http://svn.apache.org/viewvc?rev=1399983&view=rev
Log:
[CXF-4584]org.w3c.dom.DOMException when sending soap11 request and returning soap12 response


Modified:
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java?rev=1399983&r1=1399982&r2=1399983&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
Fri Oct 19 07:02:16 2012
@@ -28,6 +28,7 @@ import javax.activation.DataSource;
 import javax.xml.namespace.QName;
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.soap.SOAPPart;
 import javax.xml.stream.XMLStreamException;
@@ -38,6 +39,7 @@ import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Node;
 
 import org.apache.cxf.attachment.AttachmentDeserializer;
+import org.apache.cxf.binding.soap.Soap12;
 import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
@@ -162,6 +164,22 @@ public class MessageModeOutInterceptor e
                 message.put("write.attachments", Boolean.TRUE);
             }
             try {
+                if (message instanceof org.apache.cxf.binding.soap.SoapMessage) {
+                    org.apache.cxf.binding.soap.SoapMessage cxfSoapMessage = 
+                            (org.apache.cxf.binding.soap.SoapMessage)message;
+                    String cxfNamespace = cxfSoapMessage.getVersion().getNamespace();
+                    SOAPHeader soapHeader = soapMessage.getSOAPHeader();
+                    String namespace = soapHeader == null ? null : soapHeader.getNamespaceURI();
+                    if (namespace != null && cxfNamespace != null && !namespace.equals(cxfNamespace)

+                            && Soap12.SOAP_NAMESPACE.equals(namespace)) {
+                        cxfSoapMessage.setVersion(Soap12.getInstance());
+                        cxfSoapMessage.put(Message.CONTENT_TYPE, cxfSoapMessage.getVersion().getContentType());
+                    }
+                }
+            } catch (SOAPException e) {
+                //ignore
+            }
+            try {
                 Object enc = soapMessage.getProperty(SOAPMessage.CHARACTER_SET_ENCODING);
                 if (enc instanceof String) {
                     message.put(Message.ENCODING, enc);



Mime
View raw message