2 Replies Latest reply on May 12, 2010 9:55 AM by hadimallah

    NumberFormatException: empty String

      I'm using JBoss 4.2.3.GA

       

      I have implemented and deployed a WS, the request, the response and the exception is below.

       

      My question is how can I define a parameter of type double or int for the web service method, and the client who will invoke my WS might send nothing, as demostrated in the request below, so if i changed the double param to string it works fine, but i need to define it as int or double, I tried Double and Integer ..but did not work, same problem.

       

      Appreciate the help.

       

       

      wsdl:

       

      <message name="xxx_getTest">
          <part name="String_1" type="xsd:string">
          </part>
          <part name="String_2" type="xsd:string">
          </part>
          <part name="String_3" type="xsd:string">
          </part>
          <part name="String_4" type="xsd:string">
          </part>
          <part name="String_5" type="xsd:string">
          </part>
          <part name="Date_6" type="xsd:dateTime">
          </part>
          <part name="double_7" type="xsd:double">
          </part>
        </message>

       

       

      Request:

       

      <soapenv:Body>
        <ns1:getTest soapenv:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:ns1='http://xxx.xxxx.xxx/'>
         <String_1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='xsd:string'>54654654</String_1>
         <String_2 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true' xsi:type='xsd:string'/>
         <String_3 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='xsd:string'>3213546546</String_3>
         <String_4 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='xsd:string'>316546546</String_4>
         <String_5 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='xsd:string'>321354654</String_5>
         <Date_6 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='xsd:dateTime'>2010-05-11T20:18:13.698Z</Date_6>
         <double_7 href='#id0'/>
        </ns1:getTest>
      </soapenv:Body>

       

      Response:

       

      <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
      <env:Header/>
      <env:Body>
        <env:Fault xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
         <faultcode>env:Server</faultcode>
         <faultstring>empty String</faultstring>
        </env:Fault>
      </env:Body>
      </env:Envelope>

       

      Exception:

       

      java.lang.NumberFormatException: empty String
          at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:994)
          at java.lang.Double.valueOf(Double.java:447)
          at org.jboss.xb.binding.SimpleTypeBindings.unmarshal(SimpleTypeBindings.java:720)
          at org.jboss.ws.core.jaxrpc.binding.SimpleDeserializer.deserialize(SimpleDeserializer.java:59)
          at org.jboss.ws.core.jaxrpc.binding.SimpleDeserializer.deserialize(SimpleDeserializer.java:47)