wsdl2java generated client throws NumberFormatException on nil integer
----------------------------------------------------------------------
Key: AXIS2-1247
URL: http://issues.apache.org/jira/browse/AXIS2-1247
Project: Apache Axis 2.0 (Axis2)
Issue Type: Bug
Affects Versions: nightly
Environment: Java 1.4.2, Tomcat 4, Axis 2 Nightly Build
Reporter: Todd Doolittle
Priority: Critical
I used wsdl2java to create a client based on wsdl from a non-java service. The
wsdl specifies that one of the returned values is an integer and is nillable
like this...
<xsd:element name="ksn" nillable="true" type="xsd:int" />
When the service returns a null/nill value it looks like this in the SOAP body:
<fjs1:ksn xsi:nil="true"/>
The client code throws a number format exception while processing this...
Caused by: java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at
org.apache.axis2.databinding.utils.ConverterUtil.convertToInt(ConverterUtil.java:210)
at org.tempuri.POCStub$Item_type0$Factory.parse(POCStub.java:2149)
at org.tempuri.POCStub$Items_type1$Factory.parse(POCStub.java:1157)
at org.tempuri.POCStub$GetinfoResponse$Factory.parse(POCStub.java:1593)
at org.tempuri.POCStub.fromOM(POCStub.java:2330)
... 3 more
Here is the SOAP message my client sent (which looks fine):
POST /ws/r/poc?WSDL
HTTP/1.1
SOAPAction: getinfo
User-Agent: Axis2
Host: localhost:8090
Transfer-Encoding: chunked
Content-Type: text/xml; charset=UTF-8
160
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header />
<soapenv:Body>
<ns1:lookup xmlns:ns1="http://tempuri.org/" count="1">
<ns1:upc>2000000910</ns1:upc>
<ns1:upc
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" nil="true" />
</ns1:lookup>
</soapenv:Body>
</soapenv:Envelope>
0
Here is the non-java service's reply:
HTTP/1.1 200 OK
Date: Wed, 27 Sep 2006 15:23:37 GMT
Server: Four J's Server (Build 369)
Content-Type: text/xml; charset="UTF-8"
Content-Length: 532
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<fjs1:GetinfoResponse xmlns:fjs1="http://tempuri.org/" count="1"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<fjs1:items>
<fjs1:item>
<fjs1:ksn xsi:nil="true" />
<fjs1:upc>2000000910</fjs1:upc>
<fjs1:maintdt xsi:nil="true" />
<fjs1:dpt xsi:nil="true" />
</fjs1:item>
</fjs1:items>
</fjs1:GetinfoResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Here is the WSDL from the service...
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
name="POC" targetNamespace="http://tempuri.org/"
xmlns:fjs="http://tempuri.org/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<xsd:schema elementFormDefault="qualified"
targetNamespace="http://tempuri.org/"
xmlns:s1="http://tempuri.org/">
<xsd:element name="lookup">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0"
name="upc" nillable="true" type="xsd:string" />
</xsd:sequence>
<xsd:attribute name="count" type="xsd:int"
use="required" />
</xsd:complexType>
</xsd:element>
<xsd:element name="GetinfoResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="items" nillable="true">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded"
minOccurs="0" name="item" nillable="true">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ksn"
nillable="true" type="xsd:int" />
<xsd:element name="upc"
nillable="true" type="xsd:string" />
<xsd:element
name="maintdt" nillable="true" type="xsd:date" />
<xsd:element name="dpt"
nillable="true" type="xsd:int" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="count" type="xsd:int"
use="required" />
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="GetinfoIn">
<wsdl:part element="fjs:lookup" name="parameters" />
</wsdl:message>
<wsdl:message name="GetinfoOut">
<wsdl:part element="fjs:GetinfoResponse" name="parameters" />
</wsdl:message>
<wsdl:portType name="POCPortType">
<wsdl:operation name="Getinfo">
<wsdl:input message="fjs:GetinfoIn" name="lookup" />
<wsdl:output message="fjs:GetinfoOut"
name="GetinfoResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="POCBinding" type="fjs:POCPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Getinfo">
<soap:operation soapAction="getinfo" style="document" />
<wsdl:input name="lookup">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="GetinfoResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="POC">
<wsdl:port binding="fjs:POCBinding" name="POCPortType">
<soap:address location="http://localhost:8090/POC/POC" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
--
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]