0
votes

I'm trying to use Axis2 to connect to a SOAP webservice. This was previously working in Axis 1, but 2 is causing problems. I've regenerated the Java code using wsdl2java which has generated the stubs for Axis2, but it's falling over when processing an element of the server response with "unexpected subelement value".

The fragment of the wsdl document in question is:

<complexType name="A">
<sequence>
<element name="a" type="xsd:base64Binary" minOccurs="1" maxOccurs="1" nillable="false" />
<element name="b" type="xsd:string" minOccurs="1" maxOccurs="1" />
<element name="c" type="xsd:string" minOccurs="1" maxOccurs="1" />
<element name="d" type="xsd:string" minOccurs="1" maxOccurs="1" />
<element name="e" type="xsd:string" minOccurs="1" maxOccurs="1" />
<element name="f" type="xsd:string" minOccurs="1" maxOccurs="1" />
</sequence>
</complexType>

The response being returned looks like:

<stuff>
<a>dsfusdbifsdisuibvuidnfuisndfvl\sbvuidn</a>
<b>string</b>
<c>string</c>
<d>string</d>
<e>string</e>
<f>string</f>
</stuff>
<stuff>
<a>dsfusdbifsdisdfsfsdfsdfuibvuidnfuisndfvl\dfgd</a>
<b>string</b>
<c>string</c>
<d>string</d>
<e>string</e>
<f>string</f>
</stuff>
<stuff>
<a>dsfusdbifsdisuibvuidnfuisndfvl\sdfsdfvv</a>
<b>string</b>
<c>string</c>
<d>string</d>
<e>string</e>
<f>string</f>
</stuff>
<stuff>
<a>wwasdfgfbdfb\sbv==uidn</a>
<b>string</b>
<c>string</c>
<d>string</d>
<e>string</e>
<f>string</f>
</stuff>

sort of thing. Most of these <stuff> blocks process fine, but the last one fails on <b> with the above error. Debugging the code, it fails because reader.isStartElement() returns false and new javax.xml.namespace.QName("","b").equals(reader.getName()) is false - reader.getName() returns "a". Debugging further, reader.currentElement reports "string" instead of the wrapped object type it usually returns. I have tried this with Axiom 1.2.7 and 1.2.8 - both seem to suffer from the same problem. Is this a known bug, or can anybody shed light on what might be going on?

1

1 Answers

0
votes

Seems like this was a problem with the SAX binding generator. Switching in the JAXB bindings has fixed the problem.