axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r686273 - /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
Date Fri, 15 Aug 2008 16:18:11 GMT
Author: amilas
Date: Fri Aug 15 09:18:06 2008
New Revision: 686273

URL: http://svn.apache.org/viewvc?rev=686273&view=rev
Log:
put a recursive procedure to handle multidimentional arrays at the method signature level.

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

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java?rev=686273&r1=686272&r2=686273&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
Fri Aug 15 09:18:06 2008
@@ -722,7 +722,42 @@
             isArrayType = type.isArray();
         }
         if (isArrayType) {
-            type = type.getComponentType();
+            if (type.getComponentType().isArray()) {
+                // this is a doble array element
+                Class simpleType = type.getComponentType();
+                String simpleTypeName = "";
+                while (simpleType.isArray()) {
+                    simpleTypeName += "ArrayOf";
+                    simpleType = simpleType.getComponentType();
+                }
+                simpleTypeName += simpleType.getSimpleName();
+
+                XmlSchema xmlSchema = getXmlSchema(schemaTargetNameSpace);
+                if (xmlSchema.getTypeByName(simpleTypeName) == null) {
+                    XmlSchemaComplexType xmlSchemaComplexType = new XmlSchemaComplexType(xmlSchema);
+                    XmlSchemaSequence xmlSchemaSequence = new XmlSchemaSequence();
+                    xmlSchemaComplexType.setParticle(xmlSchemaSequence);
+                    generateSchemaForType(xmlSchemaSequence, type.getComponentType(), partName);
+                    xmlSchemaComplexType.setName(simpleTypeName);
+                    xmlSchema.getItems().add(xmlSchemaComplexType);
+                    xmlSchema.getSchemaTypes().add(
+                            new QName(xmlSchema.getTargetNamespace(), simpleTypeName), xmlSchemaComplexType);
+                }
+
+                XmlSchemaElement elt1 = new XmlSchemaElement();
+                elt1.setName(partName);
+                elt1.setSchemaTypeName(new QName(xmlSchema.getTargetNamespace(), simpleTypeName));
+                sequence.getItems().add(elt1);
+                elt1.setMaxOccurs(Long.MAX_VALUE);
+                elt1.setMinOccurs(0);
+
+                if (!type.isPrimitive()) {
+                    elt1.setNillable(true);
+                }
+                return new QName(xmlSchema.getTargetNamespace(), simpleTypeName);
+            } else {
+                type = type.getComponentType();
+            }
         }
         if (AxisFault.class.getName().equals(type)) {
             return null;



Mime
View raw message