axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wood...@apache.org
Subject svn commit: r813007 - /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
Date Wed, 09 Sep 2009 15:48:15 GMT
Author: woodroy
Date: Wed Sep  9 15:48:15 2009
New Revision: 813007

URL: http://svn.apache.org/viewvc?rev=813007&view=rev
Log:
If we are unable to find the SOAPHeader within the WSDL definition, then look deeper in the
imports to find the requested Message.

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?rev=813007&r1=813006&r2=813007&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
Wed Sep  9 15:48:15 2009
@@ -2418,6 +2418,11 @@
                             .getMessage());
 
                     if (msg == null) {
+                        msg = getMessage(wsdl4jDefinition, soapHeader
+                            .getMessage(), new HashSet());
+                    }
+                    
+                    if (msg == null) {
                         // TODO i18n this
                         throw new AxisFault("message "
                                             + soapHeader.getMessage()
@@ -2464,6 +2469,12 @@
                     // find the relevant schema part from the messages
                     Message msg = wsdl4jDefinition.getMessage(soapHeader
                             .getMessage());
+                    
+                    if (msg == null) {
+                        msg = getMessage(wsdl4jDefinition, soapHeader
+                            .getMessage(), new HashSet());
+                    }
+
                     if (msg == null) {
                         // todo i18n this
                         throw new AxisFault("message "
@@ -2574,6 +2585,40 @@
             }
         }
     }
+    
+    /**
+     * Look deeper in the imports to find the requested Message. Use a HashSet to make 
+     * sure we don't traverse the same Definition object twice (avoid recursion).
+     * 
+     * @param definition
+     * @param message
+     * @param instances
+     * @return
+     */
+    private Message getMessage(Definition definition, QName message, Set instances) {
+        Message msg = definition.getMessage(message);
+        if (msg != null) {
+            return msg;
+        }
+        Iterator iter = definition.getImports().values().iterator();
+        while (iter.hasNext()) {
+            Vector values = (Vector) iter.next();
+            for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
+                Import wsdlImport = (Import) valuesIter.next();
+                Definition innerDefinition = wsdlImport.getDefinition();
+                msg = innerDefinition.getMessage(message);
+                if (msg != null) {
+                    return msg;
+                } else {
+                    if(!instances.contains(definition)){
+                        instances.add(definition);
+                        return getMessage(definition, message, instances);
+                    }
+                }
+            }
+        }
+        return null;
+    }
 
     private int getPolicyAttachmentPoint(AxisDescription description,
                                          String originOfExtensibilityElements) {



Mime
View raw message