I am facing an issue with a SOAP Web Service Client using Axis2; the XSD file extending the WSDL holds the following definition for an element in the response, notice how no type is defined:
<xs:element name="error" minOccurs="0"/>
Following is the actual response returned by the SOAP service:
<error>
<details>Unexpected Error Occurred</details>
</error>
This is causing the following exception to be thrown by Axis2:
org.apache.axis2.AxisFault: javax.xml.stream.XMLStreamException: element text content may not contain START_ELEMENT
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at fr.cel.service.HooStub.fromOM(HooStub.java:847
The Service people are saying that since the 'error' element has no type define, then it can include everything such as string, date or an additional structure.
I wasn't really convinced; so, what does it mean to have no type defined for the element ?
Also, is there any change we can apply to the WSDL or to the Axi2 wsdl2java stub generation command, so that we avoid this ? Knowing that instead of <details>
we may actually receive some other sub-type in the response.
Update: I'm using Axis2 1.5.4, and it appears that W3C XSD specs say that we can have sub-types in this case (when using ur-type, i.e. no type defined), so why is Axis2 refusing this ?
<error>
element. See also XML Schema spec 3.3 Element declarations – potame