axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Teirney (JIRA)" <axis-...@ws.apache.org>
Subject [jira] Commented: (AXIS-2386) Java2WSDL changes type double array into a single double.
Date Tue, 21 Feb 2006 05:33:25 GMT
    [ http://issues.apache.org/jira/browse/AXIS-2386?page=comments#action_12367144 ] 

Andrew Teirney commented on AXIS-2386:
--------------------------------------

Sorry about the duplicate, hit the enter button by accident.

I myself have just come across this problem, i saw it a while back but didn't take any notice
of it. I have been doing a bit of research today axis 1.1 seems to be fine, however 1.2.1
and 1.3 are both affected, and what is in the latest snapshot to the best of my knowledge.
I don't know the exact logic that is used to generate the wsdl, but from what i can see it
looks at the XmlType and depending on whether that type has already been defined it will take
extra action such as defining the array of the objects. From a java class that has associated
metadata through the wsdl2java process i get the following...

    elemField.setFieldName("array");
    elemField.setXmlName(new javax.xml.namespace.QName("http://bug", "array"));
    elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",
"boolean"));

`array' is actually a boolean array, if i change the XmlType to something different the wsdl
is generated correctly, this seemed to be tracked down to the fact that boolean is a primitive
type and as such has no other behaviour. although this works under axis 1.1 i question where
ther xml type of `array' is infact what is generated, i decided to delve into things a little
more. instead i focused on the wsdl2java side of things. I found the actual source code emitting
coming from JavaBeanHelperWriter.java in the org.apache.axis.wsdl.toJava package. Through
lines 327->346 i noticed that there was special behaviour for arrays which ultimately gave
the refType. I decided to replace these lines with the following.

    QName xmlType = elem.getType().getQName();
    
The end result is the code emmited changed to:

    elemField.setFieldName("array");
    elemField.setXmlName(new javax.xml.namespace.QName("http://bug", "array"));
    elemField.setXmlType(new javax.xml.namespace.QName("http://bug", "ArrayOf_xsd_boolean"));

I am no expert, but to myself this does look more like what one wants, after all the type
of array is an array of xsd:boolean.

One thing i am having an issue with grasping is why a wsdl2java followed by a java2wsdl produces
a different wsdl, not in terms of the ordering of the elements, but it appears as though the
wsdl2java wraps up the inputs into a class rather than passing as parameters, this in turn
results in a different wsdl when java2wsdl is run. This maybe was is intended, just more an
observation than anything. The primary problem i have is with the array handling of primitive
types, whether this affects other types i am not sure.

> Java2WSDL changes type double array into a single double.
> ---------------------------------------------------------
>
>          Key: AXIS-2386
>          URL: http://issues.apache.org/jira/browse/AXIS-2386
>      Project: Apache Axis
>         Type: Bug
>   Components: WSDL processing
>     Versions: 1.2.1, 1.3
>  Environment: Linux 2.4.26, java version "1.5.0_04", Tomcat 5.5
>     Reporter: Eric Webster
>     Priority: Minor
>  Attachments: DataSet.wsdl, IncorrectDataSet.wsdl
>
> Java2WSDL changes type double array into a single double.
> This happens when you run Java2WSDL manually on the command line or when a wsdl file
is generated from a service_name?wsdl url.
> Currently to fix this I just manually edit the generated WSDL file and distrobute that.
> The Java code originally came from a hand made WSDL file. WSDL2Java was used to generate
the Java code. The section that is affected by this problem is the 'ValueVector' complexType
which contains and element 'values' which is an array of doubles. After converting to Java
and then back to WSDL 'values' becomes a single double. 
> Here is the original WSDL file.
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions 
>     targetNamespace="dataset.odin.cirg.washington.edu" 
>     xmlns:apachesoap="http://xml.apache.org/xml-soap" 
>     xmlns:impl="dataset.odin.cirg.washington.edu" 
>     xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
>     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
>     xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <wsdl:types>
>     <schema targetNamespace="dataset.odin.cirg.washington.edu" xmlns="http://www.w3.org/2001/XMLSchema">
>       <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
>       
>       <complexType name="ArrayOf_xsd_double">
> 	<complexContent>
> 	  <restriction base="soapenc:Array">
> 	    <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:double[]"/>
> 	  </restriction>
> 	</complexContent>
>       </complexType>
>       <complexType name="ArrayOf_xsd_string">
> 	<complexContent>
> 	  <restriction base="soapenc:Array">
> 	    <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
> 	  </restriction>
> 	</complexContent>
>       </complexType>
>       
>       <simpleType name="TypeEnum">
> 	<restriction base="xsd:string">
> 	  <enumeration value="count"/>
> 	  <enumeration value="flag"/>
> 	  <enumeration value="score"/>
> 	  <enumeration value="blank"/>
> 	  <enumeration value="error"/>
> 	  <enumeration value="other"/>
> 	  <enumeration value="unknown"/>
> 	</restriction>
>       </simpleType>
>       <simpleType name="IntervalUnitEnum">
> 	<restriction base="xsd:string">
> 	  <enumeration value="second"/>
> 	  <enumeration value="week"/>
> 	  <enumeration value="month"/>
> 	  <enumeration value="year"/>
> 	</restriction>
>       </simpleType>
>       <complexType name="Attribute">
> 	<sequence>
> 	  <element name="name" type="xsd:string"/>
> 	  <element name="value" type="xsd:string" nillable="true"/>
> 	</sequence>
>       </complexType>
>       <complexType name="ArrayOf_impl_Attribute">
> 	<complexContent>
> 	  <restriction base="soapenc:Array">
> 	    <attribute ref="soapenc:arrayType" wsdl:arrayType="impl:Attribute[]"/>
> 	  </restriction>
> 	</complexContent>
>       </complexType>
>       <complexType name="ValueVector">
> 	<sequence>
> 	  <element name="name" type="xsd:string" nillable="true"/>
> 	  <element name="type" type="impl:TypeEnum"/>
> 	  <element name="date" type="xsd:string"/>
> 	  <element name="interval" type="xsd:int"/>
> 	  <element name="intervalUnit" type="impl:IntervalUnitEnum"/>
> 	  <element name="attributes" type="impl:ArrayOf_impl_Attribute" nillable="true"/>
> 	  <element name="values" type="impl:ArrayOf_xsd_double" nillable="true"/>
> 	</sequence>
>       </complexType>
>       <complexType name="ArrayOf_impl_ValueVector">
> 	<complexContent>
> 	  <restriction base="soapenc:Array">
> 	    <attribute ref="soapenc:arrayType" wsdl:arrayType="impl:ValueVector[]"/>
> 	  </restriction>
> 	</complexContent>
>       </complexType>
>       <complexType name="DataSet">
> 	<sequence>
> 	  <element name="name" type="xsd:string" nillable="true"/>
> 	  <element name="attributes" type="impl:ArrayOf_impl_Attribute" nillable="true"/>
> 	  <element name="vectors" type="impl:ArrayOf_impl_ValueVector"/>
> 	</sequence>
>       </complexType>
>       <complexType name="ArrayOf_impl_DataSet">
> 	<complexContent>
> 	  <restriction base="soapenc:Array">
> 	    <attribute ref="soapenc:arrayType" wsdl:arrayType="impl:DataSet[]"/>
> 	  </restriction>
> 	</complexContent>
>       </complexType>
>       <complexType name="DataSetArray">
> 	<sequence>
> 	  <element name="array" type="impl:ArrayOf_impl_DataSet"/>
> 	</sequence>
>       </complexType>
>       <complexType name="SurvCol">
> 	<sequence>
> 	  <element name="name" type="xsd:string"/>
> 	  <element name="values" type="impl:ArrayOf_xsd_string"/>
> 	  <element name="attributes" type="impl:ArrayOf_impl_Attribute" nillable="true"/>
> 	</sequence>
>       </complexType>
>       <complexType name="ArrayOf_impl_SurvCol">
> 	<complexContent>
> 	  <restriction base="soapenc:Array">
> 	    <attribute ref="soapenc:arrayType" wsdl:arrayType="impl:SurvCol[]"/>
> 	  </restriction>
> 	</complexContent>
>       </complexType>
>       <complexType name="SurvDataSet">
> 	<sequence>
> 	  <element name="name" type="xsd:string" nillable="true"/>
> 	  <element name="attributes" type="impl:ArrayOf_impl_Attribute" nillable="true"/>
> 	  <element name="vectors" type="impl:ArrayOf_impl_SurvCol"/>
> 	</sequence>
>       </complexType>
>       <complexType name="ArrayOf_impl_SurvDataSet">
> 	<complexContent>
> 	  <restriction base="soapenc:Array">
> 	    <attribute ref="soapenc:arrayType" wsdl:arrayType="impl:SurvDataSet[]"/>
> 	  </restriction>
> 	</complexContent>
>       </complexType>
>       <complexType name="SurvDataSetArray">
> 	<sequence>
> 	  <element name="array" type="impl:ArrayOf_impl_SurvDataSet"/>
> 	</sequence>
>       </complexType>
>     </schema>
>   </wsdl:types>
> </wsdl:definitions>
> Here is what 'ValueVector' turns into after running WSDL2Java (which creates correct
java code) and then Java2WSDL.
>    <complexType name="ValueVector">
>     <sequence>
>      <element name="name" nillable="true" type="xsd:string"/>
>      <element name="type" type="tns2:TypeEnum"/>
>      <element name="date" type="xsd:string"/>
>      <element name="interval" type="xsd:int"/>
>      <element name="intervalUnit" type="tns2:IntervalUnitEnum"/>
>      <element name="attributes" nillable="true" type="impl:ArrayOf_tns1_Attribute"/>
>      <element name="values" nillable="true" type="xsd:double"/>
>     </sequence>
>    </complexType>

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


Mime
View raw message