axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chul Yoon <lordhalb...@hotmail.com>
Subject Axis 1.4 WSDL2java error with primitive arrays
Date Thu, 12 Jul 2007 22:18:07 GMT
This is a really old bug that appeared in Axis 1.2 but did not exist in Axis 1.1.The same bug
still exists in Axis 1.3 and Axis 1.4.The same problem has been mentioned before:http://mail-archives.apache.org/mod_mbox/ws-axis-dev/200602.mbox/%3c2127504170.1139437345017.JavaMail.jira@ajax.apache.org%3eThat
URL gives a good description of the problem.I'll try to summarize this  brieflyIf you have
a WSDL (rpc/enc) that has a primitive array like int[], double[], boolean[] that appears in
your WSDL like this:  <complexType name="ArrayOf_xsd_double">       <complexContent>
         <restriction base="soapenc:Array">             <attribute ref="soapenc:arrayType"
wsdl:arrayType="xsd:double[]"/>          </restriction>       </complexContent>
 </complexType>  <complexType name="MyClass">       <sequence>         <element
name="name" type="xsd:string" nillable="true"/>         <element name="values" type="impl:ArrayOf_xsd_double"
nillable="true"/>       </sequence>  </complexType>When you generate the source
files using wsdl2java, the primitive array is incorrectly converted into it's primitive type.So
int[] gets converted to int, and double[] gets converted to double.This will obviously not
generate correct code for the client - it won't work !!!!!Producing incorrect and inoperable
code for a client in my mind is a SHOWSTOPPER !!Not sure what your definition of a showstopper
is but it doesn't get worse than that.I fixed it in the class org.apache.axis.wsdl.toJava.JavaBeanHelperWriter
(Axis 1.4 source) by commenting out a line.The code block begins at line 329:            
                       // Some special handling for arrays.                    TypeEntry elemType
= elem.getType();                    QName xmlType = 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.                                                        
              // THIS LINE BELOW CAUSES UNDESIRED BEHAVIOR. IT'S A BUG !!!!!             
                                 // elemType = elemType.getRefType();                    
       Even though this fix works in my case, I don't know what side effects it will have.The
original author(s) had a reason to write it this way even though it created a bug.Please look
into it and fix it one and for all.This is not a minor bug !!!!!!!!!!
_________________________________________________________________
Missed the show?  Watch videos of the Live Earth Concert on MSN.
http://liveearth.msn.com
Mime
View raw message