Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.6.2
-
None
Description
Using Axis2 I have created Java stubs for the Amazon Mechanical Turk WSDL and implemented the server and client side. Now upon receiving a SOAP message, I get an ArrayIndexOutOfBoundsException on the server side:
[2012-09-19 17:26:32,907] [DEBUG] [org.apache.axis2.client.Options] - setAction Old action is (null)
[2012-09-19 17:26:32,907] [DEBUG] [org.apache.axis2.client.Options] - setAction New action is (urn:createHITResponse)
[2012-09-19 17:26:32,907] [DEBUG] [org.apache.axis2.context.ConfigurationContext] - OnDemandLogger initialized for class org.apache.axis2.context.ConfigurationContext is:org.apache.commons.logging.impl.Log4JLogger@1e34f445
[2012-09-19 17:26:32,907] [DEBUG] [org.apache.axis2.context.ConfigurationContext] - messageID is null.
[2012-09-19 17:29:17,286] [ERROR] [org.apache.axis2.rpc.receivers.RPCMessageReceiver] - 1
java.lang.ArrayIndexOutOfBoundsException: 1
at org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:630)
at org.apache.axis2.rpc.receivers.RPCUtil.processRequest(RPCUtil.java:153)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:206)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
[...]
This happens at this code position in BeanUtil.deserialize():
while ((parameterNames != null) &&
(!omElement.getQName().getLocalPart().startsWith("arg")) &&
(!omElement.getQName().getLocalPart().startsWith("item")) &&
!omElement.getQName().getLocalPart().equals(parameterNames[count])) {
// POJO handles OMElement in a differnt way so need this check for OMElement
Class paramClassType = (Class) javaTypes[count];
if (!paramClassType.getName().equals(OMElement.class.getName()))
else
{ break; }}
The access to parameterNames[count] in the while loop is causing the ArrayIndexOutOfBoundsException because count is increased beyond the array's size in the following if statement. In my case the value of paramClassType is "com.amazonaws.mturk.requester.doc._2012_03_25.CreateHIT" and not "org.apache.axiom.om.OMElement" and hence the check fails.
Is this an error in Axis2 or am I doing something wrong? Actually, I have not modified the generated code (it's automatically re-generated by Maven anyway) so I would expect that I can't do anything wrong to this respect.
(To be honest, I had to change something: I am doing
client._getServiceClient().getOptions().setProperty(org.apache.axis2.Constants.Configuration.DISABLE_SOAP_ACTION, org.apache.axis2.Constants.VALUE_TRUE);
because otherwise the client sends a SOAPAction HTTP header with the value "http://soap.amazon.com/" which causes the server not to find the action. My setup is "weird" in the sense that I am not just programming the client that shall work against Amazon Mechanical Turk but I have also implemented the server side myself and thus I am using http://localhost:4321/axis/services/amt as endpoint and not amazon.com.)