servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r486572 - in /incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/tools/wsdl: SchemaCollection.java WSDLFlattener.java
Date Wed, 13 Dec 2006 09:59:03 GMT
Author: gnodet
Date: Wed Dec 13 01:59:02 2006
New Revision: 486572

URL: http://svn.apache.org/viewvc?view=rev&rev=486572
Log:
SM-739: wsdl for pojos exported by jsr181 endpoint is missing complextypes from other namespaces
than the service itself.
Thanks to Christian Schneider and Ken Berthelot

Modified:
    incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/tools/wsdl/SchemaCollection.java
    incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/tools/wsdl/WSDLFlattener.java

Modified: incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/tools/wsdl/SchemaCollection.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/tools/wsdl/SchemaCollection.java?view=diff&rev=486572&r1=486571&r2=486572
==============================================================================
--- incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/tools/wsdl/SchemaCollection.java
(original)
+++ incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/tools/wsdl/SchemaCollection.java
Wed Dec 13 01:59:02 2006
@@ -17,6 +17,7 @@
 package org.apache.servicemix.common.tools.wsdl;
 
 import java.net.URI;
+import java.util.Collection;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -142,4 +143,19 @@
         return base.resolve(location);
     }
 
+    public int getSize() {
+        if (schemas != null) {
+           return schemas.size();
+        } else {
+           return 0;
+        }
+     }
+     
+     public Collection getSchemas() {
+        if (schemas != null) {
+           return schemas.values();
+        } else {
+           return java.util.Collections.EMPTY_SET;
+        }
+     }
 }

Modified: incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/tools/wsdl/WSDLFlattener.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/tools/wsdl/WSDLFlattener.java?view=diff&rev=486572&r1=486571&r2=486572
==============================================================================
--- incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/tools/wsdl/WSDLFlattener.java
(original)
+++ incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/tools/wsdl/WSDLFlattener.java
Wed Dec 13 01:59:02 2006
@@ -181,37 +181,19 @@
             }
             flatPort.addOperation(flatOper);
         }
-        // Get all needed direct schemas
-        Set namespaces = new HashSet();
-        for (Iterator itMsg = flat.getMessages().values().iterator(); itMsg.hasNext();) {
-            Message msg = (Message) itMsg.next();
-            for (Iterator itPart = msg.getParts().values().iterator(); itPart.hasNext();)
{
-                Part part = (Part) itPart.next();
-                QName elemName = part.getElementName();
-                if (elemName != null) {
-                    namespaces.add(elemName.getNamespaceURI());
-                    Schema schema = schemas.getSchema(elemName.getNamespaceURI());
-                    if (schema.getImports() != null) {
-                        for (Iterator iter = schema.getImports().iterator(); iter.hasNext();)
{
-                            String ns = (String) iter.next();
-                            namespaces.add(ns);
-                        }
-                    }
-                }
-            }
-        }
+        
         // Import schemas in definition
-        if (namespaces.size() > 0) {
-            Types types = flat.createTypes();
-            for (Iterator iter = namespaces.iterator(); iter.hasNext();) {
-                String ns = (String) iter.next();
-                javax.wsdl.extensions.schema.Schema imp = new SchemaImpl();
-                imp.setElement(schemas.getSchema(ns).getRoot());
-                imp.setElementType(new QName("http://www.w3.org/2001/XMLSchema", "schema"));
-                types.addExtensibilityElement(imp);
-            }
-            flat.setTypes(types);
+        if (schemas.getSize() > 0) {
+           Types types = flat.createTypes();
+           for (Iterator it = schemas.getSchemas().iterator(); it.hasNext();) {
+              javax.wsdl.extensions.schema.Schema imp = new SchemaImpl();
+              imp.setElement(((Schema)it.next()).getRoot());
+              imp.setElementType(new QName("http://www.w3.org/2001/XMLSchema", "schema"));
+              types.addExtensibilityElement(imp);
+           }
+           flat.setTypes(types);
         }
+        
         flat.addPortType(flatPort);
         return flat;
     }



Mime
View raw message