Nil decimal values cause a NumberFormatException in a wsdl2java created client
------------------------------------------------------------------------------
Key: AXIS2-1313
URL: http://issues.apache.org/jira/browse/AXIS2-1313
Project: Apache Axis 2.0 (Axis2)
Issue Type: Bug
Components: databinding
Affects Versions: nightly
Environment: Java 1.4.2, Tomcat 4, Axis 2 nightly build
Reporter: Todd Doolittle
Priority: Blocker
I created a client using wsdl2java from WSDL provided by a non-java service.
One of the elements in the response is of the type xsd:decimal. When the
service responds back with a nil value (nil="true"), the client throws a
NumberFormatException.
I also had this problem with the xsd:int, and xsd:date types previously.
Davanum fixed those issues in JIRA-1247. Now I'm experiencing the problem with
the xsd:decimal type.
Below is the exception, below that the service response, and below that the
WSDL...
Exception ! java.lang.RuntimeException: java.lang.NumberFormatException
java.lang.RuntimeException: java.lang.NumberFormatException
at org.tempuri.POCStub.fromOM(POCStub.java:2741)
at org.tempuri.POCStub.Getinfo(POCStub.java:140)
at POCTest.run(POCTest.java:44)
at POCTest.main(POCTest.java:20)
Caused by: java.lang.NumberFormatException
at java.math.BigDecimal.<init>(Unknown Source)
at java.math.BigDecimal.<init>(Unknown Source)
at
org.apache.axis2.databinding.utils.ConverterUtil.convertToDecimal(ConverterUtil.java:230)
at org.tempuri.POCStub$Decimal4Js$Factory.parse(POCStub.java:534)
at org.tempuri.POCStub$Item_type0$Factory.parse(POCStub.java:2516)
at org.tempuri.POCStub$Items_type1$Factory.parse(POCStub.java:1477)
at org.tempuri.POCStub$GetinfoResponse$Factory.parse(POCStub.java:1920)
at org.tempuri.POCStub.fromOM(POCStub.java:2733)
... 3 more
Here is the response the service sent back...
<?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 xsi:nil="true" />
<fjs1:maintdt xsi:nil="true" />
<fjs1:dpt>10</fjs1:dpt>
</fjs1:item>
</fjs1:items>
</fjs1:GetinfoResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Here is the WSDL I used to create the client with wsdl2java...
<?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:simpleType name="decimal4js">
<xsd:restriction base="xsd:decimal">
<xsd:totalDigits value="10" />
<xsd:fractionDigits value="0" />
</xsd:restriction>
</xsd:simpleType>
<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="decimal4js" />
<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://151.149.158.136:6395/ws/r/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]