Ok, now I'm confisued (or maybe I wasn't cleear enough)...

My XSD looks like (missing a few bits):
<xsd:complexType name="ClientDetailsType">
    <xsd:sequence>
      <xsd:element name="partyId" type="xsd:long"/>
      <xsd:element name="externalId" type="xsd:string"/>
      <xsd:element name="description" type="xsd:string" nillable="true" minOccurs="0"/>
      <xsd:element name="company" type="xsd:string" nillable="true" minOccurs="0"/>
      <xsd:element name="abnacn" type="xsd:string" nillable="true" minOccurs="0"/>
      <xsd:element name="cmtAccount1Id" type="xsd:integer" nillable="true" minOccurs="0" />
      <xsd:element name="cmtAccount2Id" type="xsd:integer" nillable="true" minOccurs="0" />
      <xsd:element name="lastStatement" type="xsd:date" nillable="true" minOccurs="0"/>
      <xsd:element name="status" type="status" nillable="true" minOccurs="0"/>
    </xsd:sequence>
  </xsd:complexType>

And the resulting XML from the web service call looks like:
<RetrieveClientDetailsProcessResponse xmlns=" http://www.nxf.com.au/RetrieveClientDetails">
    <StatusMsg>
        <Status xmlns="http://www.nxf.com.au/NXFMessageTypes">0</Status>
        <StatusDetailedMsg xmlns="http://www.nxf.com.au/NXFMessageTypes"/>
    </StatusMsg>
    <ClientDetails xmlns:xsi=" http://www.w3.org/2000/10/XMLSchema-instance">
        <ns1:partyId xmlns:ns1="http://www.nxf.com.au/NXFMessageTypes">13</ns1:partyId>
        <ns1:externalId xmlns:ns1="http://www.nxf.com.au/NXFMessageTypes">OPTEST1</ns1:externalId>
        <ns1:description xmlns:ns1=" http://www.nxf.com.au/NXFMessageTypes">Client 1</ns1:description>
        <ns1:company xmlns:ns1=" http://www.nxf.com.au/NXFMessageTypes" xsi:nil="true"/>
        <ns1:abnacn xmlns:ns1="http://www.nxf.com.au/NXFMessageTypes" xsi:nil="true"/>
        <ns1:cmtAccount1Id xmlns:ns1="http://www.nxf.com.au/NXFMessageTypes" xsi:nil="true"/>
        <ns1:cmtAccount2Id xmlns:ns1=" http://www.nxf.com.au/NXFMessageTypes" xsi:nil="true"/>
        <ns1:lastStatement xmlns:ns1=" http://www.nxf.com.au/NXFMessageTypes" xsi:nil="true"/>
        <ns1:status xmlns:ns1="http://www.nxf.com.au/NXFMessageTypes">ACTIVE</ns1:status>
    </ClientDetails>
</RetrieveClientDetailsProcessResponse>

When Axis2 tries to parse the cmtAccount1Id it throws the following error (seemingly ignoring the xsi:nil marker???):

 java.lang.NumberFormatException: Zero length BigInteger
 java.lang.RuntimeException: java.lang.NumberFormatException: Zero length BigInteger
  at org.apache.axis2.RetrieveClientDetailsStub.fromOM(RetrieveClientDetailsStub.java:355)
   at org.apache.axis2.RetrieveClientDetailsStub.process(RetrieveClientDetailsStub.java :114)
   at org.apache.axis2.RetrieveClientDetailsTest.testprocess(RetrieveClientDetailsTest.java:24)

To summerise, I would have thaught marking an element with xsi:nil="true" would make axis ignore the element (not try and parse it)...

Any ideas?

Cheers,
Dan

On 5/25/06, robert lazarski <[EMAIL PROTECTED]> wrote:
Isn't it Nillable == false to switch the primitive to an Object?

<xsd:element name="myInteger" type="xsd:int" nillable="false" />
HTH,
Robert
http://www.braziloutsource.com/



On 5/24/06, Dan Washusen <[EMAIL PROTECTED] > wrote:
Actually, changing it to xsd:integer doesn't work... it seems like axis is ignoring the xsi:nil?


On 5/24/06, Dan Washusen < [EMAIL PROTECTED]> wrote:
Hi All,
I'm attempting to run the Axis2 AntCodegenTask ant task to generate my Objects based on a schema.  The element in question is specified as:

<xsd:complexType name="ClientDetailsType">
    <xsd:sequence>
      <xsd:element name="cmtAccount1Id" type="xsd:long" nillable="true" />
    </xsd:sequence>
  </xsd:complexType>

When I run the ant task the ClientDetailsType class is generated with the cmtAccount1Id attribute as a primitive long and throws a NumberFormatException when I try and invoke the web service and the cmtAccount1Id is nil.  If I change the type from "xsd:long" to "xsd:integer" the BigInteger java type is used and it works...

Am I missing something?  Why is the primitive long being used if the element is specified as nillable?

Cheers,
Dan




Reply via email to