You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Todd Doolittle (JIRA)" <ji...@apache.org> on 2006/09/27 17:26:53 UTC

[jira] Created: (AXIS2-1247) wsdl2java generated client throws NumberFormatException on nil integer

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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-1247) wsdl2java generated client throws NumberFormatException on nil integer

Posted by "Tom Jordahl (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-1247?page=comments#action_12441249 ] 
            
Tom Jordahl commented on AXIS2-1247:
------------------------------------

Note that an Axis 1.x, any integer type that is nillable has to become a Java Integer.  Otherwise you can not tell if 0 is sent or it was omitted.

Axsi 2 should follow the same convention.  Any nillable type must be converted in to the Java wrapper type.

> 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: Blocker
>
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-1247) wsdl2java generated client throws NumberFormatException on nil integer

Posted by "Todd Doolittle (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-1247?page=comments#action_12438505 ] 
            
Todd Doolittle commented on AXIS2-1247:
---------------------------------------


Davanum,

Thanks for the quick fix!  The service is currently not available.  They are developing as we are, so it's not always up.  I'm trying to get a hold of them so I can test the fix.  As soon as I'm able to test it, I'll let you know.

Thanks again!
Todd

> 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: Blocker
>
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-1247) wsdl2java generated client throws NumberFormatException on nil integer

Posted by "Todd Doolittle (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-1247?page=comments#action_12438162 ] 
            
Todd Doolittle commented on AXIS2-1247:
---------------------------------------


This is also broken for the String type as well.  Using the WSDL above I received a message that had a nil=true value for a String type (the "upc" element). 

The WSDL defines the "upc" element like this...

<xsd:element name="upc" nillable="true" type="xsd:string" />

When the service returns this in the body...

<fjs1:upc xsi:nil="true" />

 I get the following exception...

Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
	at java.lang.String.charAt(Unknown Source)
	at org.apache.axis2.databinding.utils.ConverterUtil.convertToDate(ConverterUtil.java:326)
	at org.tempuri.POCStub$Item_type0$Factory.parse(POCStub.java:2204)
	at org.tempuri.POCStub$Items_type1$Factory.parse(POCStub.java:1156)
	at org.tempuri.POCStub$GetinfoResponse$Factory.parse(POCStub.java:1592)
	at org.tempuri.POCStub.fromOM(POCStub.java:2329)
	... 3 more
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
	at java.lang.String.charAt(Unknown Source)
	at org.apache.axis2.databinding.utils.ConverterUtil.convertToDate(ConverterUtil.java:326)
	at org.tempuri.POCStub$Item_type0$Factory.parse(POCStub.java:2204)
	at org.tempuri.POCStub$Items_type1$Factory.parse(POCStub.java:1156)
	at org.tempuri.POCStub$GetinfoResponse$Factory.parse(POCStub.java:1592)
	at org.tempuri.POCStub.fromOM(POCStub.java:2329)
	at org.tempuri.POCStub.Getinfo(POCStub.java:136)
	at POCTest.run(POCTest.java:44)
	at POCTest.main(POCTest.java:20)

Here is the SOAP message my client received back from the service :

<?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>1234567890</fjs1:ksn>
          <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>


> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-1247) wsdl2java generated client throws NumberFormatException on nil integer

Posted by "Todd Doolittle (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-1247?page=comments#action_12438166 ] 
            
Todd Doolittle commented on AXIS2-1247:
---------------------------------------


Oops in the above comment, I was incorrect.  It's the date typed "maintdt" element that is causing the problem.  The wsdl specifies...

<xsd:element name="maintdt" nillable="true" type="xsd:date" />

The message returned from the service contained this...

<fjs1:maintdt xsi:nil="true" /> 

And the wsdl2java generated client threw this ...

Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0 
at java.lang.String.charAt(Unknown Source) 
at org.apache.axis2.databinding.utils.ConverterUtil.convertToDate(ConverterUtil.java:326) 
at org.tempuri.POCStub$Item_type0$Factory.parse(POCStub.java:2204) 
at org.tempuri.POCStub$Items_type1$Factory.parse(POCStub.java:1156) 
at org.tempuri.POCStub$GetinfoResponse$Factory.parse(POCStub.java:1592) 
at org.tempuri.POCStub.fromOM(POCStub.java:2329) 
... 3 more 
java.lang.StringIndexOutOfBoundsException: String index out of range: 0 
at java.lang.String.charAt(Unknown Source) 
at org.apache.axis2.databinding.utils.ConverterUtil.convertToDate(ConverterUtil.java:326) 
at org.tempuri.POCStub$Item_type0$Factory.parse(POCStub.java:2204) 
at org.tempuri.POCStub$Items_type1$Factory.parse(POCStub.java:1156) 
at org.tempuri.POCStub$GetinfoResponse$Factory.parse(POCStub.java:1592) 
at org.tempuri.POCStub.fromOM(POCStub.java:2329) 
at org.tempuri.POCStub.Getinfo(POCStub.java:136) 
at POCTest.run(POCTest.java:44) 
at POCTest.main(POCTest.java:20) 



> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-1247) wsdl2java generated client throws NumberFormatException on nil integer

Posted by "Todd Doolittle (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-1247?page=comments#action_12438169 ] 
            
Todd Doolittle commented on AXIS2-1247:
---------------------------------------


One last comment.  nil String typed elements don't throw an exception but I'm not sure the behaviour is correct.  The WSDL specifies this...

<xsd:element name="upc" nillable="true" type="xsd:string" /> 

The service sends this back in the reply...

<fjs1:upc xsi:nil="true" /> 

The getUpc() method generated by the wsdl2java returns an empty string (i.e. "").  Shouldn't it return a NULL?  I mean isn't there semantically a difference between this...

<fjs1:upc></fjs:upc> //(empty String)

and this...

<fjs1:upc xsi:nil="true"/> //(null/nil String)

?






> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-1247) wsdl2java generated client throws NumberFormatException on nil integer

Posted by "Todd Doolittle (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-1247?page=comments#action_12440177 ] 
            
Todd Doolittle commented on AXIS2-1247:
---------------------------------------


I just tried this with a decimal type.  The wsdl2java generated client throws a number format exception when the decimal is returned as nil="true".  This looks related to the problems that were resolved above for the xsd:int and xsd:date types.

Below is the exception, the service response, and 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>


> 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: Blocker
>
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-1247) wsdl2java generated client throws NumberFormatException on nil integer

Posted by "Davanum Srinivas (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS2-1247?page=all ]

Davanum Srinivas updated AXIS2-1247:
------------------------------------

    Priority: Blocker  (was: Critical)

Definitely a blocker.

> 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: Blocker
>
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-1247) wsdl2java generated client throws NumberFormatException on nil integer

Posted by "Todd Doolittle (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-1247?page=comments#action_12438721 ] 
            
Todd Doolittle commented on AXIS2-1247:
---------------------------------------


I tested this and it appears to work.  Strings come back as NULL, Dates come back as NULL, and integers come back as 0 when the message specifies nil="true".

The only problem I see now is there no way to differentiate between an integer that was really sent as 0, and one that was sent as nil/null.  Would it be better to set the integer value to Integer.MIN_VALUE instead of 0 when it is sent as nil/null?  It would make it easier to identify.  Another option would be to add a boolean method is<memberName>Null (i.e. isKsnNull()) for each integer value.  Another option would be to use the wrapper class Integer instead of int, but that's probably a lot more work.

Thanks again for the quick response!!!
Todd

> 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: Blocker
>
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Resolved: (AXIS2-1247) wsdl2java generated client throws NumberFormatException on nil integer

Posted by "Davanum Srinivas (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS2-1247?page=all ]

Davanum Srinivas resolved AXIS2-1247.
-------------------------------------

    Resolution: Fixed

checked in a fix. please try nightly in an hour or so. tested using the following code as this is a non-java server response.

import org.tempuri.GetinfoResponse;

import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import java.io.StringReader;

public class Main {
    public static void main(String[] args) throws Exception {
        String responseXML = "<fjs1:GetinfoResponse xmlns:fjs1=\"http://tempuri.org/\" count=\"1\"\n" +
                "      xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n" +
                "      xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +
                "      <fjs1:items>\n" +
                "        <fjs1:item>\n" +
                "          <fjs1:ksn xsi:nil=\"true\" />\n" +
                "          <fjs1:upc>2000000910</fjs1:upc>\n" +
                "          <fjs1:maintdt xsi:nil=\"true\" />\n" +
                "          <fjs1:dpt xsi:nil=\"true\" />\n" +
                "        </fjs1:item>\n" +
                "      </fjs1:items>\n" +
                "    </fjs1:GetinfoResponse>";
        XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(responseXML));
        reader.next();
        GetinfoResponse response = GetinfoResponse.Factory.parse(reader);
        System.out.println(response);
    }
}


thx,
dims



> 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: Blocker
>
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org