Author: aslom
Date: Mon Nov 28 15:10:57 2005
New Revision: 349551

URL: http://svn.apache.org/viewcvs?rev=349551&view=rev
Log:
manually diffed and applied chnages for 
WSIF-74 Multiple soap:header and soap:headerfault elements not accepted by 
WSIFOperation_ApacheAxis
http://issues.apache.org/jira/browse/WSIF-74

Modified:
    
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFOperation_ApacheAxis.java

Modified: 
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFOperation_ApacheAxis.java
URL: 
http://svn.apache.org/viewcvs/webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFOperation_ApacheAxis.java?rev=349551&r1=349550&r2=349551&view=diff
==============================================================================
--- 
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFOperation_ApacheAxis.java
 (original)
+++ 
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFOperation_ApacheAxis.java
 Mon Nov 28 15:10:57 2005
@@ -130,14 +130,18 @@
     transient protected List inputSOAPParts;
     transient protected List inputUnwrappedSOAPParts;
     transient protected List inputMIMEParts;
-    transient protected Part inputSOAPHeader;
-    transient protected Part inputSOAPHeaderFault;
+//    transient protected Part inputSOAPHeader;
+//    transient protected Part inputSOAPHeaderFault;
+    transient protected List inputSOAPHeader;
+    transient protected List inputSOAPHeaderFault;
     
     protected List outputSOAPParts;
     protected List outputUnwrappedSOAPParts;
     protected List outputMIMEParts;
-    protected Part outputSOAPHeader;
-    protected Part outputSOAPHeaderFault;
+    //protected Part outputSOAPHeader;
+    //protected Part outputSOAPHeaderFault;
+    protected List outputSOAPHeader;
+    protected List outputSOAPHeaderFault;
     
     transient protected String inputEncodingStyle;
     transient protected String inputNamespace;
@@ -466,15 +470,22 @@
                 "internal error, unexpected object: " + element);
         }
         
-        Part soapHeaderPart = null;
-        Part soapHeaderFaultPart = null;
+        List soapHeaderParts = new ArrayList();
+        List soapHeaderFaultParts = new ArrayList();
         
-        SOAPHeader soapHeader =
-            (SOAPHeader) wsifPort.getExtElem(
+        List soapHeaders =
+            wsifPort.getExtElems(
             element,
             javax.wsdl.extensions.soap.SOAPHeader.class,
             extensabilityElements);
-        if (soapHeader != null) {
+        if ((soapHeaders == null) || (soapHeaders.size() == 0))
+        {
+            return;
+        }
+        for (int i = 0; i < soapHeaders.size(); i++)
+        {
+            SOAPHeader soapHeader = (SOAPHeader)soapHeaders.get(i);
+            
             QName messageName = soapHeader.getMessage();
             if (messageName == null) {
                 throw new WSIFException(
@@ -485,48 +496,53 @@
                 throw new WSIFException(
                     "no part attribute on soap:header: " + soapHeader);
             }
-            soapHeaderPart = getPart(messageName, messagePart);
+            Part soapHeaderPart = getPart(messageName, messagePart);
             if (soapHeaderPart == null) {
                 throw new WSIFException(
                     "non existent part specified on soap:header: "
                         + soapHeader);
             }
+            soapHeaderParts.add(soapHeaderPart);
             
-            SOAPHeaderFault soapHeaderFault =
-                (SOAPHeaderFault) wsifPort.getExtElem(
-                soapHeader,
-                javax.wsdl.extensions.soap.SOAPHeaderFault.class,
-                extensabilityElements);
-            if (soapHeaderFault != null) {
-                messageName = soapHeader.getMessage();
+            List soapHeaderFaults = soapHeader.getSOAPHeaderFaults();
+            if ((soapHeaderFaults == null) || (soapHeaderFaults.size() == 0))
+            {
+                continue;
+            }
+            for (int j = 0; j < soapHeaderFaults.size(); j++)
+            {
+                SOAPHeaderFault soapHeaderFault =
+                    (SOAPHeaderFault)soapHeaderFaults.get(j);
+            
+                messageName = soapHeaderFault.getMessage();
                 if (messageName == null) {
                     throw new WSIFException(
-                        "no message attribute on soap:header: " + soapHeader);
+                        "no message attribute on soap:headerfault: " + 
soapHeader);
                 }
-                messagePart = soapHeader.getPart();
+                messagePart = soapHeaderFault.getPart();
                 if (messagePart == null) {
                     throw new WSIFException(
-                        "no part attribute on soap:header: " + soapHeader);
+                        "no part attribute on soap:headerfault: " + 
soapHeader);
                 }
-                soapHeaderFaultPart = getPart(messageName, messagePart);
+                Part soapHeaderFaultPart = getPart(messageName, messagePart);
                 if (soapHeaderFaultPart == null) {
                     throw new WSIFException(
-                        "non existent part specified on soap:header: "
+                        "non existent part specified on soap:headerfault: "
                             + soapHeader);
                 }
+                soapHeaderFaultParts.add(soapHeaderFaultPart);
             }
         }
         
         if (element instanceof BindingInput) {
-            this.inputSOAPHeader = soapHeaderPart;
-            this.inputSOAPHeaderFault = soapHeaderFaultPart;
+            this.inputSOAPHeader = soapHeaderParts;
+            this.inputSOAPHeaderFault = soapHeaderFaultParts;
         } else {
-            this.outputSOAPHeader = soapHeaderPart;
-            this.outputSOAPHeaderFault = soapHeaderFaultPart;
+            this.outputSOAPHeader = soapHeaderParts;
+            this.outputSOAPHeaderFault = soapHeaderFaultParts;
         }
         //TODO now go and do something with them...
     }
-    
     /**
      * Validates the soap:body WSDL element.
      * The soap:body WSDL element has the form:


Reply via email to