Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 32683 invoked from network); 29 Sep 2006 14:11:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 29 Sep 2006 14:11:03 -0000 Received: (qmail 83138 invoked by uid 500); 29 Sep 2006 14:10:50 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 82931 invoked by uid 500); 29 Sep 2006 14:10:48 -0000 Mailing-List: contact axis-dev-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-dev@ws.apache.org Received: (qmail 82716 invoked by uid 99); 29 Sep 2006 14:10:48 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Sep 2006 07:10:46 -0700 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests= Received: from [209.237.227.198] ([209.237.227.198:35330] helo=brutus.apache.org) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id B8/54-13110-3692D154 for ; Fri, 29 Sep 2006 07:10:44 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 8EEEC714204 for ; Fri, 29 Sep 2006 14:06:50 +0000 (GMT) Message-ID: <28337591.1159538810567.JavaMail.jira@brutus> Date: Fri, 29 Sep 2006 07:06:50 -0700 (PDT) From: "Todd Doolittle (JIRA)" To: axis-dev@ws.apache.org Subject: [jira] Commented: (AXIS2-1247) wsdl2java generated client throws NumberFormatException on nil integer In-Reply-To: <19845023.1159370813146.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ 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 isNull (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... > > When the service returns a null/nill value it looks like this in the SOAP body: > > 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 > > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> > > > > 2000000910 > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" nil="true" /> > > > > 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 > > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > > > > 2000000910 > > > > > > > > Here is the WSDL from the service... > > 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"> > > targetNamespace="http://tempuri.org/" > xmlns:s1="http://tempuri.org/"> > > > > name="upc" nillable="true" type="xsd:string" /> > > use="required" /> > > > > > > > > > minOccurs="0" name="item" nillable="true"> > > > nillable="true" type="xsd:int" /> > nillable="true" type="xsd:string" /> > name="maintdt" nillable="true" type="xsd:date" /> > nillable="true" type="xsd:int" /> > > > > > > > > use="required" /> > > > > > > > > > > > > > > name="GetinfoResponse" /> > > > > > > > > > > > > > > > > > > > > -- 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