axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Jordahl" <tjord...@adobe.com>
Subject RE: Axis 1.4 WSDL2java error with primitive arrays
Date Wed, 25 Jul 2007 18:32:51 GMT
Hi Chul,

 

I would recommend you make your change and run all of the Axis 1.x unit
tests ("ant clean all-tests")  to see what breaks (if anything) because
of this change.  One of the problems we have always had in Axis 1.x is
that a "simple" change to fix one bug ends up breaking (as you saw)
another case.

 

Since this is an open source project and there is no dedicated test
engineering group, the confidence that we aren't breaking someone with
simple fixes gets lower and lower.  Especially since Axis 1.x is in
virtual stasis and the active development is happening on Axis2.

 

In any case, I would open a JIRA bug report, if you haven't already, and
place your patch in the bug - ensuring that it passes all tests when
built with the current SVN source.  For extra credit, you can write a
new unit test that demonstrates the problem and include that as part of
the patch.  This ensures that the bug will stay fixed in the future.

 

Thanks for your help.

 

--

Tom Jordahl

 

________________________________

From: Chul Yoon [mailto:lordhalbert@hotmail.com] 
Sent: Thursday, July 12, 2007 6:18 PM
To: axis-dev@ws.apache.org
Subject: Axis 1.4 WSDL2java error with primitive arrays

 

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/%3c2127
504170.1139437345017.JavaMail.jira@ajax.apache.org%3e

That URL gives a good description of the problem.
I'll try to summarize this  briefly

If 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 !!!!!!!!!!


Mime
View raw message