Cryptic fault when trying to call an XFire SOAP service using a SOAP client generated with Axis
spostelnicu in
Java, General
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
January 22nd, 2007 at 5:42 pm
[...] One big problem that I had was that at first I tried to access the XFire service with the Axis client that I already have. Big mistake! After half a day of stepping through the XFire code, I discovered that the problem was that my client was sending a request as RPC/encoded, which XFire does not support. And instead of telling me that, XFire was simply returning a fault with the internal exception message, which was: “ Index: 1, Size: 1 “. [...]