Engineering Insights & Enterprise solutions
I encountered a problem when trying to call an XFire SOAP service using a SOAP client generated with Axis, and after finding the “solution” I decided to share it with you so you won’t have to repeat my steps.
I’ll be short:
When trying to call an XFire SOAP service using a SOAP client generated with Axis, I get the following (very cryptic) fault:
Index: 1, Size: 1
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
faultSubcode:
faultString: Index: 1, Size: 1
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:Index: 1, Size: 1
This is generated by an internal IndexArrayOutOfBoundsException (which I couldn’t determine only after step-by-step debugging through the XFire sources), at line 191 in org.codehaus.xfire.service.binding.AbstractBinding (xfire-distribution-1.2.4-sources.jar):
p = (MessagePartInfo) opInfo.getInputMessage().getMessageParts().get(param);
Basically, the parser is trying to get the next XML element in the request, which doesn’t exist.
When examining the SOAP message, I found this:
<soapenv:Body>
<ns1:myMethod soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="urn:MyNamespace">
<in0 href="#id0" />
</ns1:myMethod>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
........
So it seems that the request is using RPC encoding, which unfortunately XFire doesn’t support.
In conclusion: do not access a service published with XFire with a client-generated by Axis, unless you change the default request encoding style from RPC/Encoded to WRAPPED/Literal.
technorati tags: XFire, SOAP, Axis, Fault, RPC/Encoded