Hi all,
I'm having a problem with an Axis2 webservice and it's driving me nuts for all
day now, please help me out.
Basically, it comes down to this:
My webservice returns an array of categories to my client program and when no
categories are found, a zero-sized array is returned to indicate this.
However, when I try to return an empty-sized array, an ArrayIndexOutOfBound
error is thrown.
Here's the relevant WSDL scheme:
<complexType name="Category">
<all>
<element name="id" type="xsd:int"/>
<element name="parent" type="xsd:int"/>
<element name="title" type="xsd:string"/>
</all>
</complexType>
<complexType name="CategoryArray">
<sequence>
<element name="category" minOccurs="0" maxOccurs="unbounded"
type="myxsd:Category"/>
</sequence>
</complexType>
The Java-code calls the autogenerated (WSDL2java) toEnvelope method:
org.apache.axis2.databinding.ADBSOAPModelBuilder builder = new
org.apache.axis2.databinding.ADBSOAPModelBuilder(param.getPullParser(com.bpower2.ws.instrudeo.xsd.AvailableCategoriesResponse.MY_QNAME),
factory);
return builder.getEnvelope();
When I debug this (autogenerated) piece of code with a breakpoint on the
return statement, the debugger says
"com.sun.jdi.InvocationException occurred invoking method"
when inspecting the "body" member of the "builder" variable, so I guess the
problem must be around that position somewhere.
I hope this is enough information. Please help me out with this one, I'm
debugging for all damn day now and you're my last resort.
Bram