You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "João Conceição (JIRA)" <ji...@apache.org> on 2011/07/21 14:07:58 UTC

[jira] [Created] (AXIS2-5097) Axis2 problem with concurrent requests mismatch response object

Axis2 problem with concurrent requests mismatch response object
---------------------------------------------------------------

                 Key: AXIS2-5097
                 URL: https://issues.apache.org/jira/browse/AXIS2-5097
             Project: Axis2
          Issue Type: Bug
          Components: databinding
    Affects Versions: 1.6.0, 1.2
         Environment: Tomcat 5.5.25 for the application server
Axis2 1.2 or 1.6 for the Web Service
Java version 1.5.0_11
            Reporter: João Conceição
            Priority: Critical


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

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


[jira] [Closed] (AXIS2-5097) Axis2 problem with concurrent requests mismatch response object

Posted by "João Conceição (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

João Conceição closed AXIS2-5097.
---------------------------------

    Resolution: Not A Problem

The problem can be solved by setting one RPCMessageReceiver for each method on file services.xml

> Axis2 problem with concurrent requests mismatch response object
> ---------------------------------------------------------------
>
>                 Key: AXIS2-5097
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5097
>             Project: Axis2
>          Issue Type: Bug
>          Components: databinding
>    Affects Versions: 1.2, 1.6.0
>         Environment: Tomcat 5.5.25 for the application server
> Axis2 1.2 or 1.6 for the Web Service
> Java version 1.5.0_11
>            Reporter: João Conceição
>            Priority: Critical
>              Labels: Axis2, Java
>
> 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

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


[jira] [Updated] (AXIS2-5097) Axis2 problem with concurrent requests mismatch response object

Posted by "João Conceição (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

João Conceição updated AXIS2-5097:
----------------------------------


Found the solution for this problem.

When you have a service (RequestMethods) with more than one method defined (request1 and request2), it's necessary to set one RPCMessageReceiver for each method to avoid concurrency problems.

You can define one MessageReceiver for each method on file services.xml.

In the example I post, the file services.xml should be like this:

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

> Axis2 problem with concurrent requests mismatch response object
> ---------------------------------------------------------------
>
>                 Key: AXIS2-5097
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5097
>             Project: Axis2
>          Issue Type: Bug
>          Components: databinding
>    Affects Versions: 1.2, 1.6.0
>         Environment: Tomcat 5.5.25 for the application server
> Axis2 1.2 or 1.6 for the Web Service
> Java version 1.5.0_11
>            Reporter: João Conceição
>            Priority: Critical
>              Labels: Axis2, Java
>
> 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

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org