axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject svn commit: r449445 - /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
Date Sun, 24 Sep 2006 18:16:39 GMT
Author: ajith
Date: Sun Sep 24 11:16:39 2006
New Revision: 449445

URL: http://svn.apache.org/viewvc?view=rev&rev=449445
Log:
1. Fixed the recursive WSDL import problem mentioned in issue 1222. However that particular
WSDL still has a problem that needs expert advice to sort out
(the build is successful!)

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?view=diff&rev=449445&r1=449444&r2=449445
==============================================================================
--- 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
Sun Sep 24 11:16:39 2006
@@ -112,6 +112,10 @@
 
     private Map schemaMap = null;
 
+    
+    private static final String JAVAX_WSDL_VERBOSE_MODE_KEY = "javax.wsdl.verbose";
+    private static final String JAVAX_WSDL_IMPORT_DOCUMENTS_MODE_KEY = "javax.wsdl.importDocuments";
+
     /**
      * constructor taking in the service name and the port name
      *
@@ -262,7 +266,9 @@
         processPoliciesInDefintion(wsdl4jDefinition);
 
         // process the imports
-        processImports(wsdl4jDefinition);
+        //send an empty list as the processed namespace list since this
+        //is the first call
+        processImports(wsdl4jDefinition,new ArrayList());
 
         // setup the schemaMap
         schemaMap = populateSchemaMap(wsdl4jDefinition.getTypes());
@@ -1378,7 +1384,7 @@
      *
      * @param wsdl4JDefinition
      */
-    private void processImports(Definition wsdl4JDefinition) {
+    private void processImports(Definition wsdl4JDefinition,List processedSchemaNamespaces)
{
         Map wsdlImports = wsdl4JDefinition.getImports();
 
         if (null != wsdlImports && !wsdlImports.isEmpty()) {
@@ -1391,8 +1397,15 @@
 
                     if (wsdlImport.getDefinition() != null) {
                         Definition importedDef = wsdlImport.getDefinition();
+
                         if (importedDef != null) {
-                            processImports(importedDef);
+                            // stop recursive imports!
+                            if (processedSchemaNamespaces.contains(importedDef.getTargetNamespace()))
{
+                                return;
+                            }else{
+                                processedSchemaNamespaces.add(importedDef.getTargetNamespace());
+                            }
+                            processImports(importedDef,processedSchemaNamespaces);
 
                             //copy ns
                             Map namespaces = importedDef.getNamespaces();
@@ -1460,13 +1473,13 @@
         WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
 
         //switch off the verbose mode for all usecases
-        reader.setFeature("javax.wsdl.verbose", false);
+        reader.setFeature(JAVAX_WSDL_VERBOSE_MODE_KEY, false);
 
         //if the custem resolver is present then use it
         if (customWSLD4JResolver != null) {
             return reader.readWSDL(customWSLD4JResolver);
         } else {
-            reader.setFeature("javax.wsdl.importDocuments", false);
+            reader.setFeature(JAVAX_WSDL_IMPORT_DOCUMENTS_MODE_KEY, false);
             Document doc;
             try {
                 doc = XMLUtils.newDocument(in);



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message