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:40:30 UTC

svn commit: r692774 - /servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java

Author: ffang
Date: Sat Sep  6 21:40:30 2008
New Revision: 692774

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

Modified:
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java?rev=692774&r1=692773&r2=692774&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java Sat Sep  6 21:40:30 2008
@@ -24,7 +24,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;
 
@@ -97,6 +99,13 @@
                         + 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);
             if (bop == null) {
@@ -141,6 +150,21 @@
         }
     }
 
+    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 getRPCPartWrapper(BindingMessageInfo msg,