You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Collin Peters <ca...@gmail.com> on 2007/05/08 00:21:02 UTC

NumerFormatException when sending a null int

There has to be a simple answer for this that I haven't been able to
find.  This is one of those difficult things to search for because all
the terms are very common.

I have a simple value object class that is being sent via a simple web
service call.  Inside the class are some Integer variables that may
not be set when sent.  So I can easily create a new VO class, and send
it from my client to the server.

The problem is that on the server I get a NumberFormatException
because it is trying to create an Integer from an empty string.  The
exact error is:
java.lang.NumberFormatException: For input string: ""
	at java.lang.NumberFormatException.forInputString(Unknown Source)
	at java.lang.Integer.parseInt(Unknown Source)
	...

Using tcpmon I see that the SOAP being sent is:
...
         <soapInsertUser xmlns="http://dataimport.processes.ix/xsd">
            <arg0 xmlns="">
               <firstname>hank</firstname>
               <lastname>hank</lastname>
               <assignedUserID
xmlns:nil="http://ww.w3.org/2001/XMLSchema-instance" nil:nil="true" />
            </arg0>
         </soapInsertUser>
...

So my question is... why is it taking a null value, and trying to call
parseInt on an empty string?  What I thought would have happened is
that it would correctly deserialize into a null value, or that it
wouldn't even send the null value in the SOAP call.

There has to be something simple that I am missing here.  I am using
Axis 2 and can provide code if necessary.  Please point me to any docs
that are applicable to this subject.

Regards,
Collin Peters

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


Re: NumerFormatException when sending a null int

Posted by Collin Peters <ca...@gmail.com>.
Hmm.... I upgraded to Axis2 1.2 (recently released) and it seems to
have fixed this problem.

On 5/7/07, Collin Peters <ca...@gmail.com> wrote:
> Hmm.... no, it was auto-mapped to <xs:element name="assignedUserID"
> type="xs:int"/>
>
> How do I set this nillable to be true?  Must I not use auto-generated
> WSDL?  For this particular class (which has 50+ variables) nearly all
> of the variables can be null.  Is there some easy way to set all
> fields to be nillable?
>
> On 5/7/07, Martin Gainty <mg...@hotmail.com> wrote:
> > <xs:element name="getAssignedUserId">
> > <xs:complexType>
> > <xs:sequence>
> > <xs:element type="xs:integer" nillable="true" name="assignedUserID" />
> > </xs:sequence>
> > </xs:complexType>
> > </xs:element>
> >
> > have you verified the element has nillable="true" attribute??
> > M--
> > This email message and any files transmitted with it contain confidential
> > information intended only for the person(s) to whom this email message is
> > addressed.  If you have received this email message in error, please notify
> > the sender immediately by telephone or email and destroy the original
> > message without making a copy.  Thank you.
> >
> > ----- Original Message -----
> > From: "Collin Peters" <ca...@gmail.com>
> > To: <ax...@ws.apache.org>
> > Sent: Monday, May 07, 2007 6:21 PM
> > Subject: NumerFormatException when sending a null int
> >
> >
> > > There has to be a simple answer for this that I haven't been able to
> > > find.  This is one of those difficult things to search for because all
> > > the terms are very common.
> > >
> > > I have a simple value object class that is being sent via a simple web
> > > service call.  Inside the class are some Integer variables that may
> > > not be set when sent.  So I can easily create a new VO class, and send
> > > it from my client to the server.
> > >
> > > The problem is that on the server I get a NumberFormatException
> > > because it is trying to create an Integer from an empty string.  The
> > > exact error is:
> > > java.lang.NumberFormatException: For input string: ""
> > > at java.lang.NumberFormatException.forInputString(Unknown Source)
> > > at java.lang.Integer.parseInt(Unknown Source)
> > > ...
> > >
> > > Using tcpmon I see that the SOAP being sent is:
> > > ...
> > >         <soapInsertUser xmlns="http://dataimport.processes.ix/xsd">
> > >            <arg0 xmlns="">
> > >               <firstname>hank</firstname>
> > >               <lastname>hank</lastname>
> > >               <assignedUserID
> > > xmlns:nil="http://ww.w3.org/2001/XMLSchema-instance" nil:nil="true" />
> > >            </arg0>
> > >         </soapInsertUser>
> > > ...
> > >
> > > So my question is... why is it taking a null value, and trying to call
> > > parseInt on an empty string?  What I thought would have happened is
> > > that it would correctly deserialize into a null value, or that it
> > > wouldn't even send the null value in the SOAP call.
> > >
> > > There has to be something simple that I am missing here.  I am using
> > > Axis 2 and can provide code if necessary.  Please point me to any docs
> > > that are applicable to this subject.
> > >
> > > Regards,
> > > Collin Peters
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>

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


Re: NumerFormatException when sending a null int

Posted by Collin Peters <ca...@gmail.com>.
Hmm.... no, it was auto-mapped to <xs:element name="assignedUserID"
type="xs:int"/>

How do I set this nillable to be true?  Must I not use auto-generated
WSDL?  For this particular class (which has 50+ variables) nearly all
of the variables can be null.  Is there some easy way to set all
fields to be nillable?

On 5/7/07, Martin Gainty <mg...@hotmail.com> wrote:
> <xs:element name="getAssignedUserId">
> <xs:complexType>
> <xs:sequence>
> <xs:element type="xs:integer" nillable="true" name="assignedUserID" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
> have you verified the element has nillable="true" attribute??
> M--
> This email message and any files transmitted with it contain confidential
> information intended only for the person(s) to whom this email message is
> addressed.  If you have received this email message in error, please notify
> the sender immediately by telephone or email and destroy the original
> message without making a copy.  Thank you.
>
> ----- Original Message -----
> From: "Collin Peters" <ca...@gmail.com>
> To: <ax...@ws.apache.org>
> Sent: Monday, May 07, 2007 6:21 PM
> Subject: NumerFormatException when sending a null int
>
>
> > There has to be a simple answer for this that I haven't been able to
> > find.  This is one of those difficult things to search for because all
> > the terms are very common.
> >
> > I have a simple value object class that is being sent via a simple web
> > service call.  Inside the class are some Integer variables that may
> > not be set when sent.  So I can easily create a new VO class, and send
> > it from my client to the server.
> >
> > The problem is that on the server I get a NumberFormatException
> > because it is trying to create an Integer from an empty string.  The
> > exact error is:
> > java.lang.NumberFormatException: For input string: ""
> > at java.lang.NumberFormatException.forInputString(Unknown Source)
> > at java.lang.Integer.parseInt(Unknown Source)
> > ...
> >
> > Using tcpmon I see that the SOAP being sent is:
> > ...
> >         <soapInsertUser xmlns="http://dataimport.processes.ix/xsd">
> >            <arg0 xmlns="">
> >               <firstname>hank</firstname>
> >               <lastname>hank</lastname>
> >               <assignedUserID
> > xmlns:nil="http://ww.w3.org/2001/XMLSchema-instance" nil:nil="true" />
> >            </arg0>
> >         </soapInsertUser>
> > ...
> >
> > So my question is... why is it taking a null value, and trying to call
> > parseInt on an empty string?  What I thought would have happened is
> > that it would correctly deserialize into a null value, or that it
> > wouldn't even send the null value in the SOAP call.
> >
> > There has to be something simple that I am missing here.  I am using
> > Axis 2 and can provide code if necessary.  Please point me to any docs
> > that are applicable to this subject.
> >
> > Regards,
> > Collin Peters
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

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


Re: NumerFormatException when sending a null int

Posted by Martin Gainty <mg...@hotmail.com>.
<xs:element name="getAssignedUserId">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:integer" nillable="true" name="assignedUserID" />
</xs:sequence>
</xs:complexType>
</xs:element>

have you verified the element has nillable="true" attribute??
M--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

----- Original Message ----- 
From: "Collin Peters" <ca...@gmail.com>
To: <ax...@ws.apache.org>
Sent: Monday, May 07, 2007 6:21 PM
Subject: NumerFormatException when sending a null int


> There has to be a simple answer for this that I haven't been able to
> find.  This is one of those difficult things to search for because all
> the terms are very common.
> 
> I have a simple value object class that is being sent via a simple web
> service call.  Inside the class are some Integer variables that may
> not be set when sent.  So I can easily create a new VO class, and send
> it from my client to the server.
> 
> The problem is that on the server I get a NumberFormatException
> because it is trying to create an Integer from an empty string.  The
> exact error is:
> java.lang.NumberFormatException: For input string: ""
> at java.lang.NumberFormatException.forInputString(Unknown Source)
> at java.lang.Integer.parseInt(Unknown Source)
> ...
> 
> Using tcpmon I see that the SOAP being sent is:
> ...
>         <soapInsertUser xmlns="http://dataimport.processes.ix/xsd">
>            <arg0 xmlns="">
>               <firstname>hank</firstname>
>               <lastname>hank</lastname>
>               <assignedUserID
> xmlns:nil="http://ww.w3.org/2001/XMLSchema-instance" nil:nil="true" />
>            </arg0>
>         </soapInsertUser>
> ...
> 
> So my question is... why is it taking a null value, and trying to call
> parseInt on an empty string?  What I thought would have happened is
> that it would correctly deserialize into a null value, or that it
> wouldn't even send the null value in the SOAP call.
> 
> There has to be something simple that I am missing here.  I am using
> Axis 2 and can provide code if necessary.  Please point me to any docs
> that are applicable to this subject.
> 
> Regards,
> Collin Peters
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
>

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