axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lord Halbert (JIRA)" <axis-...@ws.apache.org>
Subject [jira] Issue Comment Edited: (AXIS-2386) Java2WSDL changes type double array into a single double.
Date Wed, 25 Jul 2007 22:57:31 GMT

    [ https://issues.apache.org/jira/browse/AXIS-2386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12514020
] 

Lord Halbert edited comment on AXIS-2386 at 7/25/07 3:57 PM:
-------------------------------------------------------------

Ok, it's me again.

I've attached a test WSDL file:  test.wsdl

Note the int[] array in the wsdl.

Generate the Java source code for this by doing a wsdl2java.

You'll notice in the generated TestParams.java file the following:

   static {
        ...
        elemField.setXmlName(new javax.xml.namespace.QName("", "someArray"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",
"int"));
        ....
    }

Do you see the "int" definition of "someArray" - that's wrong, very wrong.
The array has been converted into a simple "int" instead of "int[]".

This is the source of the problem.

If you generate a WSDL file from the class (Java2WSDL) or have it autogenerated (?wsdl), you'll
see that "someArray" has been converted into an "int". If you're relying on your client to
generate operable code from WSDL in this manner, it won't work !!

It's totally broken - borked would be the right word to use here.

If version Axis 1.4.1 has only ONE fix, this is the one to put in it !!!!!!

Sorry for ranting but i've wasted many hours on this bug.








 was:
Ok, it's me again.

Here's a WSDL you can try to test this bug:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="urn:test.company.com"
xmlns:intf="urn:test.company.com" 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" targetNamespace="urn:test.company.com">
	<wsdl:types>
		<schema targetNamespace="urn:test.company.com" xmlns="http://www.w3.org/2001/XMLSchema">
			<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
			<complexType name="ArrayOf_xsd_int">
				<complexContent>
					<restriction base="soapenc:Array">
						<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:int[]"/>
					</restriction>
				</complexContent>
			</complexType>
			<complexType name="TestParams">
				<sequence>
					<element name="someArray" nillable="true" type="impl:ArrayOf_xsd_int"/>
					<element name="someStringValue" nillable="true" type="xsd:string"/>
				</sequence>
			</complexType>
		</schema>
	</wsdl:types>
	<wsdl:message name="doSomethingRequest">
		<wsdl:part name="testParams" type="impl:TestParams"/>
	</wsdl:message>
	<wsdl:message name="doSomethingResponse">
		<wsdl:part name="doSomethingReturn" type="xsd:int"/>
	</wsdl:message>
	<wsdl:portType name="TestService">
		<wsdl:operation name="doSomething" parameterOrder="testParams">
			<wsdl:input name="doSomethingRequest" message="impl:doSomethingRequest"/>
			<wsdl:output name="doSomethingResponse" message="impl:doSomethingResponse"/>
		</wsdl:operation>
	</wsdl:portType>
	<wsdl:binding name="TestServicePortSoapBinding" type="impl:TestService">
		<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
		<wsdl:operation name="doSomething">
			<wsdlsoap:operation/>
			<wsdl:input name="doSomethingRequest">
				<wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:test.company.com"/>
			</wsdl:input>
			<wsdl:output name="doSomethingResponse">
				<wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:test.company.com"/>
			</wsdl:output>
		</wsdl:operation>
	</wsdl:binding>
	<wsdl:service name="TestService">
		<wsdl:port name="TestServicePort" binding="impl:TestServicePortSoapBinding">
			<wsdlsoap:address location="http://localhost:8600/services/test"/>
		</wsdl:port>
	</wsdl:service>
</wsdl:definitions>


Note the int[] array in the wsdl.

Generate the Java source code for this by doing a wsdl2java.

You'll notice in the generated TestParams.java file the following:

   static {
        ...
        elemField.setXmlName(new javax.xml.namespace.QName("", "someArray"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",
"int"));
        ....
    }

Do you see the "int" definition of "someArray" - that's wrong, very wrong.
The array has been converted into a simple "int" instead of "int[]".

This is the source of the problem.

If you generate a WSDL file from the class (Java2WSDL) or have it autogenerated (?wsdl), you'll
see that "someArray" has been converted into an "int". If you're relying on your client to
generate operable code from WSDL in this manner, it won't work !!

It's totally broken - borked would be the right word to use here.

If version Axis 1.4.1 has only ONE fix, this is the one to put in it !!!!!!

Sorry for ranting but i've wasted many hours on this bug.







> Java2WSDL changes type double array into a single double.
> ---------------------------------------------------------
>
>                 Key: AXIS-2386
>                 URL: https://issues.apache.org/jira/browse/AXIS-2386
>             Project: Axis
>          Issue Type: Bug
>          Components: WSDL processing
>    Affects Versions: 1.2, 1.2.1, 1.3, 1.4
>         Environment: Not specific to an environment. It's only specific to the Axis version
used.
>            Reporter: Eric Webster
>            Priority: Blocker
>         Attachments: DataSet.wsdl, IncorrectDataSet.wsdl, test.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.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Mime
View raw message