ElementDesc class incorrect for String[]
----------------------------------------

         Key: AXIS-2504
         URL: http://issues.apache.org/jira/browse/AXIS-2504
     Project: Apache Axis
        Type: Bug

  Components: Deployment / Registries  
    Versions: 1.4    
    Reporter: Leif Mortenson


I have a class which generates output based on the descriptor objects of a 
deployed web application.   One of my operations take an object as a parameter. 
 That object has a field of class String[].   The operation itself all works 
perfectly.   However when I ElementDesc for that field getFields of the 
TypeDesc, the getXmlType() method always returns a QName that resolves to 
String.class.

>From the API, it looks like the getArrayType() should be returning a QName 
>which resolves to String[].class.  In my case ArrayOf_xsd_string.

Looking at the code, the getArrayType method currently always returns null.

I was able to fix this by modifying the following class: 

org.apache.axis.wsdl.toJava.JavaBeanHelperWriter:
-----
Index: 
D:/Apache/axis-1.x-svn/src/org/apache/axis/wsdl/toJava/JavaBeanHelperWriter.java
===================================================================
--- 
D:/Apache/axis-1.x-svn/src/org/apache/axis/wsdl/toJava/JavaBeanHelperWriter.java
    (revision 415249)
+++ 
D:/Apache/axis-1.x-svn/src/org/apache/axis/wsdl/toJava/JavaBeanHelperWriter.java
    (working copy)
@@ -328,13 +328,13 @@
                     // Some special handling for arrays.
                     TypeEntry elemType = elem.getType();
                     QName xmlType = null;
-
+                    QName arrayType = null;
                     if ((elemType.getDimensions().length() > 1)
                             && (elemType.getClass() == DefinedType.class)) {
-
                         // If we have a DefinedType with dimensions, it must
                         // be a SOAP array derived type.  In this case, use
                         // the refType's QName for the metadata.
+                        arrayType = elemType.getQName();
                         elemType = elemType.getRefType();
                     } else if (elemType.getClass() == DefinedElement.class
                             && elemType.getRefType() != null) {
@@ -375,6 +375,10 @@
                         pw.println("        elemField.setXmlType("
                                 + Utils.getNewQName(xmlType) + ");");
                     }
+                    if (arrayType != null) {
+                        pw.println("        elemField.setArrayType("
+                                + Utils.getNewQName(arrayType) + ");");
+                    }
 
                     if (elem.getMinOccursIs0()) {
                         pw.println("        elemField.setMinOccurs(0);");
@@ -388,6 +392,7 @@
                     if(elem.getMaxOccursIsUnbounded()) {
                         pw.println("        
elemField.setMaxOccursUnbounded(true);");
                     }
+                    
                     QName itemQName = elem.getType().getItemQName();
                     if (itemQName != null) {
                         pw.println("        elemField.setItemQName(" +
-----

Thanks,
Leif

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to