You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2008/09/07 06:38:39 UTC

svn commit: r692773 - /servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java

Author: ffang
Date: Sat Sep  6 21:38:39 2008
New Revision: 692773

URL: http://svn.apache.org/viewvc?rev=692773&view=rev
Log:
[SM-1556]CXF BC Provider strips namespace declarations from jbi wrapper element

Modified:
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java?rev=692773&r1=692772&r2=692773&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java (original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java Sat Sep  6 21:38:39 2008
@@ -26,7 +26,9 @@
 import javax.xml.stream.XMLStreamWriter;
 import javax.xml.transform.Source;
 
+import org.w3c.dom.Attr;
 import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
@@ -102,6 +104,13 @@
                         + QNameUtil.toString(element) + "' but expected '{"
                         + JbiConstants.WSDL11_WRAPPER_NAMESPACE + "}message'"));
             }
+            
+            //save namespace which is potentially used by the soap message
+            List<Attr> nsList = saveLaterUsedNS(element);
+            //add the saved namespace to the soap body
+            for (Attr attr : nsList) {
+                xmlWriter.writeAttribute(attr.getName(), attr.getValue());
+            }
 
             BindingOperationInfo bop = message.getExchange().get(
                     BindingOperationInfo.class);
@@ -149,6 +158,22 @@
         }
     }
 
+    private List<Attr> saveLaterUsedNS(Element element) {
+        List<Attr> nsList = new ArrayList<Attr>();
+        NamedNodeMap attributes = element.getAttributes();
+        for (int i = 0; i < attributes.getLength(); i++) {
+            if (attributes.item(i) instanceof Attr) {
+                Attr attr = (Attr) attributes.item(i);
+                if (attr.getName().startsWith("xmlns:")
+                        && !(attr.getName().startsWith("xmlns:" + JbiConstants.WSDL11_WRAPPER_MESSAGE_PREFIX)
+                                || attr.getName().startsWith("xmlns:" + JbiConstants.WSDL11_WRAPPER_PREFIX))) {
+                    nsList.add(attr);
+                }
+            }
+        }
+        return nsList;
+    }
+
     
     
     private void setContentType(SoapMessage message) {