servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r358136 - /incubator/servicemix/trunk/servicemix-components/src/main/java/org/servicemix/components/saaj/SaajMarshaler.java
Date Tue, 20 Dec 2005 23:03:42 GMT
Author: gnodet
Date: Tue Dec 20 15:03:38 2005
New Revision: 358136

URL: http://svn.apache.org/viewcvs?rev=358136&view=rev
Log:
Fix problem with Saaj binding, where namespaces may disapear if put on the envelope.

Modified:
    incubator/servicemix/trunk/servicemix-components/src/main/java/org/servicemix/components/saaj/SaajMarshaler.java

Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/servicemix/components/saaj/SaajMarshaler.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/main/java/org/servicemix/components/saaj/SaajMarshaler.java?rev=358136&r1=358135&r2=358136&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/main/java/org/servicemix/components/saaj/SaajMarshaler.java
(original)
+++ incubator/servicemix/trunk/servicemix-components/src/main/java/org/servicemix/components/saaj/SaajMarshaler.java
Tue Dec 20 15:03:38 2005
@@ -20,6 +20,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.servicemix.jbi.jaxp.SourceTransformer;
+import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 
 import javax.activation.DataHandler;
@@ -58,6 +59,17 @@
         SOAPPart soapPart = soapMessage.getSOAPPart();
         SOAPBody soapBody = soapPart.getEnvelope().getBody();
         SOAPElement elem = (SOAPElement) soapBody.getChildElements().next();
+        
+        for (SOAPElement parent = elem.getParentElement(); parent != null; parent = parent.getParentElement())
{
+        	for (int i = 0; i < parent.getAttributes().getLength(); i++) {
+        		Attr att = (Attr) parent.getAttributes().item(i);
+        		if (att.getName().startsWith("xmlns:") && 
+        			elem.getAttributeNodeNS(att.getNamespaceURI(), att.getLocalName()) == null) {
+        			elem.setAttributeNS(att.getNamespaceURI(), att.getName(), att.getValue());
+        		}
+        	}
+        }
+        
         normalizedMessage.setContent(new DOMSource(elem));
 
         addNmsAttachments(normalizedMessage, soapMessage);



Mime
View raw message