servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r651147 - /servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
Date Thu, 24 Apr 2008 04:08:45 GMT
Author: ffang
Date: Wed Apr 23 21:08:45 2008
New Revision: 651147

URL: http://svn.apache.org/viewvc?rev=651147&view=rev
Log:
[SM-1328]cxf bc provider should support unqualified fault defined in the wsdl

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

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.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/JbiInWsdl1Interceptor.java?rev=651147&r1=651146&r2=651147&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
Wed Apr 23 21:08:45 2008
@@ -49,6 +49,7 @@
 import org.apache.cxf.service.model.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.staxutils.PartialXMLStreamReader;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.servicemix.jbi.util.QNameUtil;
@@ -212,7 +213,6 @@
 
     private void handleJBIFault(SoapMessage message, Element soapFault) {
         Document doc = DomUtil.createDocument();
-
         Element jbiFault = DomUtil.createElement(doc, new QName(
                 JBIConstants.NS_JBI_BINDING, JBIFault.JBI_FAULT_ROOT));
         Node jbiFaultDetail = null;
@@ -223,11 +223,34 @@
             jbiFaultDetail = doc.importNode(soapFault.getElementsByTagName(
                     "soap:Detail").item(0).getFirstChild(), true);
         }
+        SchemaInfo schemaInfo = 
+            getOperation(message).getBinding().getService().getSchema(jbiFaultDetail.getNamespaceURI());
+        if (!schemaInfo.isElementFormQualified()) {
+            //that's unquailied fault
+            jbiFaultDetail = addEmptyDefaultTns((Element)jbiFaultDetail);
+        }
         jbiFault.appendChild(jbiFaultDetail);
         message.setContent(Source.class, new DOMSource(doc));
         message.put("jbiFault", true);
     }
 
+    private Element addEmptyDefaultTns(Element ret) {
+        
+        if (!ret.hasAttribute("xmlns")) {
+            ret.setAttribute("xmlns", "");
+        }
+        NodeList nodes = ret.getChildNodes();
+        for (int i = 0; i < nodes.getLength(); i++) {
+            if (nodes.item(i) instanceof Element) {
+                Element ele = (Element) nodes.item(i);
+                ele = addEmptyDefaultTns(ele);
+
+            }
+        }
+        return ret;
+    }
+
+    
     private NodeList wrapNodeList(final NodeList childNodes) {
         return new NodeList() {
             public int getLength() {



Mime
View raw message