Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5097

Axis2 problem with concurrent requests mismatch response object

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Not A Problem
    • 1.2, 1.6.0
    • None
    • databinding
    • Tomcat 5.5.25 for the application server
      Axis2 1.2 or 1.6 for the Web Service
      Java version 1.5.0_11

    Description

      I'm facing a problem on my production server for a Web Service with concurrent requests.

      The problem is that when the Web Service receives (for instance) two requests for two different methods (each method returning a different object) in the same service, the Web Service will return the object type of the second request.

      To replicate and simplify the problem I create a simple Web Service with only one service and two methods with the same environment of the production server.

      RequestMethods.class:

      package test;

      import beans.Request1Response;
      import beans.Request2Response;

      public class RequestMethods {

      public Request1Response request1() {
      Request1Response output = new Request1Response();

      try

      { Thread.sleep(10 * 1000); }

      catch (InterruptedException e)

      { e.printStackTrace(); }

      output.setError_code(1);
      output.setError_msg("message1");

      return output;
      }

      public Request2Response request2()

      { Request2Response output = new Request2Response(); output.setError_code(2); output.setError_msg("message2"); return output; }

      }

      services.xml:

      <service name="RequestMethods">
      <Description>
      Concurrent Requests test
      </Description>
      <messageReceivers>
      <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
      <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
      </messageReceivers>
      <parameter name="ServiceClass" locked="false">test.RequestMethods</parameter>
      </service>

      I've made a request for request1 and before this one returns, made another request for request2.

      The result for request1 (the first request but the second obtained response because of the sleep of 10 seconds) was:

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Body>
      <ns:request2Response xmlns:ns="http://test/xsd">
      <ns:return>
      <error_code xmlns="http://beans/xsd">1</error_code>
      <error_msg xmlns="http://beans/xsd">message1</error_msg>
      </ns:return>
      </ns:request2Response>
      </soapenv:Body>
      </soapenv:Envelope>

      The result for request2 (the second request but the first obtained response) was:

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Body>
      <ns:request2Response xmlns:ns="http://test/xsd">
      <ns:return>
      <error_code xmlns="http://beans/xsd">2</error_code>
      <error_msg xmlns="http://beans/xsd">message2</error_msg>
      </ns:return>
      </ns:request2Response>
      </soapenv:Body>
      </soapenv:Envelope>

      As you can see above, the response for request1 it should be of type request1Response but it's from request2Response instead.

      Regards,
      João Conceição

      Attachments

        Activity

          People

            Unassigned Unassigned
            jpconceicao João Conceição
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: