You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Håkon Sagehaug <Ha...@bccs.uib.no> on 2009/09/16 13:02:03 UTC

Creating a async web sercice

Hi


I wanted to try out to make a web service async, does anyone know of a
cookbook how to do that? I found this link[1] explaning how I want my
service to work. is it the AsyncMessageReceiver  from the integration module
in axis2 svn I should use? Basically I need som help and guide how to enable
async behavior on the server side, I know how to do it on the client side,
for getting a non-blocking using two transport channels.

any tips or hint on this topic?

cheers, Håkon


[1] http://www.ibm.com/developerworks/webservices/library/ws-axis2/

-- 
Håkon Sagehaug, Scientific Programmer
Parallab, Bergen Center for Computational Science (BCCS)
UNIFOB AS (University of Bergen Research Company)

Re: Creating a async web sercice

Posted by Amila Suriarachchi <am...@gmail.com>.
2009/9/18 Håkon Sagehaug <Ha...@bccs.uib.no>

> Hi
>
> By the way, do you know why it did not work with 1.4.1, it this a known
> limitation?


this parameter check added after axis2 1.4.1 :)

thanks,
Amila.

>
>
> cheers, Håkon
>
>
> 2009/9/17 Håkon Sagehaug <Ha...@bccs.uib.no>
>
>> Hi
>>
>> I changed to axis2 1.5 also on the server and then all seems to work.
>> Thanks for the help
>>
>>
>> cheers, Håkon
>>
>> 2009/9/17 Håkon Sagehaug <Ha...@bccs.uib.no>
>>
>>> Hi
>>>
>>> I also get this error message
>>>
>>> SEVERE: The Callback for MessageID
>>> urn:uuid:E75DBDF30A77DAB1011253193935432 was not found
>>> org.apache.axis2.AxisFault: The Callback for MessageID
>>> urn:uuid:E75DBDF30A77DAB1011253193935432 was not found
>>>
>>> cheers, Håkon
>>>
>>>
>>> 2009/9/17 Håkon Sagehaug <Ha...@bccs.uib.no>
>>>
>>> Hi
>>>>
>>>> I used axis2 1.4.1 and changed to 1.5, but I still got time out. I
>>>> changed just on the client side, server is still using 1.4.1
>>>>
>>>>
>>>>
>>>> 2009/9/17 Amila Suriarachchi <am...@gmail.com>
>>>>
>>>>> What is the Axis2 version you use? try with Axis2 1.5.
>>>>>
>>>>> hope you have set the parameter correctly.
>>>>>
>>>> On the server or client side?
>>>> The service.xml looks like this
>>>> <service name="EchoService">
>>>>         <messageReceivers>
>>>>             <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
>>>> class="no.uib.bccs.esysbio.echoservice.EchoServiceMessageReceiverInOut"/>
>>>>         </messageReceivers>
>>>>
>>>>         <parameter
>>>> name="messageReceiver.invokeOnSeparateThread">true</parameter>
>>>>         <parameter
>>>> name="ServiceClass">no.uib.bccs.esysbio.echoservice.EchoServiceImpl</parameter>
>>>>         <parameter name="useOriginalwsdl">true</parameter>
>>>>         <parameter name="modifyUserWSDLPortAddress">true</parameter>
>>>>         <operation name="SayHi" mep="http://www.w3.org/ns/wsdl/in-out"
>>>> namespace="http://www.bccs.uib.no/EchoService.wsdl">
>>>>             <actionMapping>
>>>> http://www.bccs.uib.no/EchoService.wsdl/SayHi</actionMapping>
>>>>             <outputActionMapping>
>>>> http://www.bccs.uib.no/EchoService.wsdl/EchoServicePortType/SayHiResponse
>>>> </outputActionMapping>
>>>>         </operation>
>>>>     </service>
>>>>
>>>> And in my message receiver I print out this
>>>>
>>>> Using async Parameter? : messageReceiver.invokeOnSeparateThread=true
>>>>
>>>> So to me the server side looks correct, any more tips on the client
>>>>
>>>> cheers, Håkon
>>>>
>>>>
>>>>>
>>>>> thanks,
>>>>> Amila.
>>>>>
>>>>> 2009/9/17 Håkon Sagehaug <Ha...@bccs.uib.no>
>>>>>
>>>>> hi
>>>>>>
>>>>>> thanks for the tip.
>>>>>>
>>>>>> I've added the parameter to the service.xml file. For simulating a
>>>>>> "long" running ws I 've got a simple echo service where I sleep the thread
>>>>>> in 1 minute, like this
>>>>>>
>>>>>> try {
>>>>>>         Thread.sleep(60000);
>>>>>>     } catch (InterruptedException e) {
>>>>>>         e.printStackTrace();
>>>>>>     }
>>>>>>
>>>>>>
>>>>>>
>>>>>> And my client looks like this
>>>>>>
>>>>>>
>>>>>> EchoServiceStub stub;
>>>>>>     try {
>>>>>>
>>>>>>         ConfigurationContext context = ConfigurationContextFactory
>>>>>>             .createConfigurationContextFromFileSystem("repository",
>>>>>>                 null);
>>>>>>
>>>>>>         stub = new EchoServiceStub(context,
>>>>>>             "http://localhost:8080/axis2/services/EchoService");
>>>>>>         stub._getServiceClient().engageModule("addressing");
>>>>>>
>>>>>>         EchoServiceCallbackHandler callback = new
>>>>>> EchoServiceCallbackHandler() {
>>>>>>
>>>>>>         public void receiveResultSayHi(SayHiResponse resp) {
>>>>>>             System.out.print("in callback " + resp.getHiResponse());
>>>>>>             System.exit(0);
>>>>>>         }
>>>>>>
>>>>>>         public void receiveErrorSayHi(Exception e) {
>>>>>>             e.printStackTrace();
>>>>>>
>>>>>>         }
>>>>>>         };
>>>>>>
>>>>>>
>>>>>>         SayHi hi = new SayHi();
>>>>>>         hi.setHi("testu");
>>>>>>
>>>>>>
>>>>>> stub._getServiceClient().getOptions().setUseSeparateListener(true);
>>>>>>
>>>>>>         stub.startSayHi(hi, callback);
>>>>>>     } catch (AxisFault e) {
>>>>>>         e.printStackTrace();
>>>>>>     } catch (RemoteException e) {
>>>>>>         e.printStackTrace();
>>>>>>     }
>>>>>>     }
>>>>>>
>>>>>> But even when I use separate transport listeners I get
>>>>>>
>>>>>> org.apache.axis2.AxisFault: Read timed out
>>>>>>     at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
>>>>>>     at
>>>>>> org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)
>>>>>>     at
>>>>>> org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
>>>>>>     at
>>>>>> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:371)
>>>>>>     at
>>>>>> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:209)
>>>>>>     at
>>>>>> org.apache.axis2.engine.AxisEngine$TransportNonBlockingInvocationWorker.run(AxisEngine.java:630)
>>>>>>     at
>>>>>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
>>>>>>     at
>>>>>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
>>>>>>     at java.lang.Thread.run(Thread.java:619)
>>>>>>
>>>>>> on the client side.
>>>>>>
>>>>>> Any more configuration needed on either sides?
>>>>>>
>>>>>> cheers, Håkon
>>>>>>
>>>>>>
>>>>>> 2009/9/17 Amila Suriarachchi <am...@gmail.com>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> 2009/9/16 Håkon Sagehaug <Ha...@bccs.uib.no>
>>>>>>>
>>>>>>>> Hi
>>>>>>>>
>>>>>>>>
>>>>>>>> I wanted to try out to make a web service async, does anyone know of
>>>>>>>> a cookbook how to do that? I found this link[1] explaning how I want my
>>>>>>>> service to work. is it the AsyncMessageReceiver  from the integration module
>>>>>>>> in axis2 svn I should use? Basically I need som help and guide how to enable
>>>>>>>> async behavior on the server side, I know how to do it on the client side,
>>>>>>>> for getting a non-blocking using two transport channels.
>>>>>>>>
>>>>>>>> any tips or hint on this topic?
>>>>>>>>
>>>>>>>
>>>>>>> you need to set this parameter messageReceiver.invokeOnSeparateThread
>>>>>>> to true in your service.
>>>>>>>
>>>>>>> ie. <parameter
>>>>>>> name="messageReceiver.invokeOnSeparateThread">true</parameter>
>>>>>>>
>>>>>>> if the request contains a replyTo header service invocation happens
>>>>>>> in a separate thread.
>>>>>>>
>>>>>>> thanks,
>>>>>>> Amila.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> cheers, Håkon
>>>>>>>>
>>>>>>>>
>>>>>>>> [1] http://www.ibm.com/developerworks/webservices/library/ws-axis2/
>>>>>>>>
>>>>>>>> --
>>>>>>>> Håkon Sagehaug, Scientific Programmer
>>>>>>>> Parallab, Bergen Center for Computational Science (BCCS)
>>>>>>>> UNIFOB AS (University of Bergen Research Company)
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Amila Suriarachchi
>>>>>>> WSO2 Inc.
>>>>>>> blog: http://amilachinthaka.blogspot.com/
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Håkon Sagehaug, Scientific Programmer
>>>>>> Parallab, Bergen Center for Computational Science (BCCS)
>>>>>> UNIFOB AS (University of Bergen Research Company)
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Amila Suriarachchi
>>>>> WSO2 Inc.
>>>>> blog: http://amilachinthaka.blogspot.com/
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Håkon Sagehaug, Scientific Programmer
>>>> Parallab, Bergen Center for Computational Science (BCCS)
>>>> UNIFOB AS (University of Bergen Research Company)
>>>>
>>>
>>>
>>>
>>> --
>>> Håkon Sagehaug, Scientific Programmer
>>> Parallab, Bergen Center for Computational Science (BCCS)
>>> UNIFOB AS (University of Bergen Research Company)
>>>
>>
>>
>>
>> --
>> Håkon Sagehaug, Scientific Programmer
>> Parallab, Bergen Center for Computational Science (BCCS)
>> UNIFOB AS (University of Bergen Research Company)
>>
>
>
>
> --
> Håkon Sagehaug, Scientific Programmer
> Parallab, Bergen Center for Computational Science (BCCS)
> UNIFOB AS (University of Bergen Research Company)
>



-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Re: Creating a async web sercice

Posted by Håkon Sagehaug <Ha...@bccs.uib.no>.
Hi

By the way, do you know why it did not work with 1.4.1, it this a known
limitation?

cheers, Håkon


2009/9/17 Håkon Sagehaug <Ha...@bccs.uib.no>

> Hi
>
> I changed to axis2 1.5 also on the server and then all seems to work.
> Thanks for the help
>
>
> cheers, Håkon
>
> 2009/9/17 Håkon Sagehaug <Ha...@bccs.uib.no>
>
>> Hi
>>
>> I also get this error message
>>
>> SEVERE: The Callback for MessageID
>> urn:uuid:E75DBDF30A77DAB1011253193935432 was not found
>> org.apache.axis2.AxisFault: The Callback for MessageID
>> urn:uuid:E75DBDF30A77DAB1011253193935432 was not found
>>
>> cheers, Håkon
>>
>>
>> 2009/9/17 Håkon Sagehaug <Ha...@bccs.uib.no>
>>
>> Hi
>>>
>>> I used axis2 1.4.1 and changed to 1.5, but I still got time out. I
>>> changed just on the client side, server is still using 1.4.1
>>>
>>>
>>>
>>> 2009/9/17 Amila Suriarachchi <am...@gmail.com>
>>>
>>>> What is the Axis2 version you use? try with Axis2 1.5.
>>>>
>>>> hope you have set the parameter correctly.
>>>>
>>> On the server or client side?
>>> The service.xml looks like this
>>> <service name="EchoService">
>>>         <messageReceivers>
>>>             <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
>>> class="no.uib.bccs.esysbio.echoservice.EchoServiceMessageReceiverInOut"/>
>>>         </messageReceivers>
>>>
>>>         <parameter
>>> name="messageReceiver.invokeOnSeparateThread">true</parameter>
>>>         <parameter
>>> name="ServiceClass">no.uib.bccs.esysbio.echoservice.EchoServiceImpl</parameter>
>>>         <parameter name="useOriginalwsdl">true</parameter>
>>>         <parameter name="modifyUserWSDLPortAddress">true</parameter>
>>>         <operation name="SayHi" mep="http://www.w3.org/ns/wsdl/in-out"
>>> namespace="http://www.bccs.uib.no/EchoService.wsdl">
>>>             <actionMapping>http://www.bccs.uib.no/EchoService.wsdl/SayHi
>>> </actionMapping>
>>>             <outputActionMapping>
>>> http://www.bccs.uib.no/EchoService.wsdl/EchoServicePortType/SayHiResponse
>>> </outputActionMapping>
>>>         </operation>
>>>     </service>
>>>
>>> And in my message receiver I print out this
>>>
>>> Using async Parameter? : messageReceiver.invokeOnSeparateThread=true
>>>
>>> So to me the server side looks correct, any more tips on the client
>>>
>>> cheers, Håkon
>>>
>>>
>>>>
>>>> thanks,
>>>> Amila.
>>>>
>>>> 2009/9/17 Håkon Sagehaug <Ha...@bccs.uib.no>
>>>>
>>>> hi
>>>>>
>>>>> thanks for the tip.
>>>>>
>>>>> I've added the parameter to the service.xml file. For simulating a
>>>>> "long" running ws I 've got a simple echo service where I sleep the thread
>>>>> in 1 minute, like this
>>>>>
>>>>> try {
>>>>>         Thread.sleep(60000);
>>>>>     } catch (InterruptedException e) {
>>>>>         e.printStackTrace();
>>>>>     }
>>>>>
>>>>>
>>>>>
>>>>> And my client looks like this
>>>>>
>>>>>
>>>>> EchoServiceStub stub;
>>>>>     try {
>>>>>
>>>>>         ConfigurationContext context = ConfigurationContextFactory
>>>>>             .createConfigurationContextFromFileSystem("repository",
>>>>>                 null);
>>>>>
>>>>>         stub = new EchoServiceStub(context,
>>>>>             "http://localhost:8080/axis2/services/EchoService");
>>>>>         stub._getServiceClient().engageModule("addressing");
>>>>>
>>>>>         EchoServiceCallbackHandler callback = new
>>>>> EchoServiceCallbackHandler() {
>>>>>
>>>>>         public void receiveResultSayHi(SayHiResponse resp) {
>>>>>             System.out.print("in callback " + resp.getHiResponse());
>>>>>             System.exit(0);
>>>>>         }
>>>>>
>>>>>         public void receiveErrorSayHi(Exception e) {
>>>>>             e.printStackTrace();
>>>>>
>>>>>         }
>>>>>         };
>>>>>
>>>>>
>>>>>         SayHi hi = new SayHi();
>>>>>         hi.setHi("testu");
>>>>>
>>>>>
>>>>> stub._getServiceClient().getOptions().setUseSeparateListener(true);
>>>>>
>>>>>         stub.startSayHi(hi, callback);
>>>>>     } catch (AxisFault e) {
>>>>>         e.printStackTrace();
>>>>>     } catch (RemoteException e) {
>>>>>         e.printStackTrace();
>>>>>     }
>>>>>     }
>>>>>
>>>>> But even when I use separate transport listeners I get
>>>>>
>>>>> org.apache.axis2.AxisFault: Read timed out
>>>>>     at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
>>>>>     at
>>>>> org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)
>>>>>     at
>>>>> org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
>>>>>     at
>>>>> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:371)
>>>>>     at
>>>>> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:209)
>>>>>     at
>>>>> org.apache.axis2.engine.AxisEngine$TransportNonBlockingInvocationWorker.run(AxisEngine.java:630)
>>>>>     at
>>>>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
>>>>>     at
>>>>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
>>>>>     at java.lang.Thread.run(Thread.java:619)
>>>>>
>>>>> on the client side.
>>>>>
>>>>> Any more configuration needed on either sides?
>>>>>
>>>>> cheers, Håkon
>>>>>
>>>>>
>>>>> 2009/9/17 Amila Suriarachchi <am...@gmail.com>
>>>>>
>>>>>
>>>>>>
>>>>>> 2009/9/16 Håkon Sagehaug <Ha...@bccs.uib.no>
>>>>>>
>>>>>>> Hi
>>>>>>>
>>>>>>>
>>>>>>> I wanted to try out to make a web service async, does anyone know of
>>>>>>> a cookbook how to do that? I found this link[1] explaning how I want my
>>>>>>> service to work. is it the AsyncMessageReceiver  from the integration module
>>>>>>> in axis2 svn I should use? Basically I need som help and guide how to enable
>>>>>>> async behavior on the server side, I know how to do it on the client side,
>>>>>>> for getting a non-blocking using two transport channels.
>>>>>>>
>>>>>>> any tips or hint on this topic?
>>>>>>>
>>>>>>
>>>>>> you need to set this parameter messageReceiver.invokeOnSeparateThread
>>>>>> to true in your service.
>>>>>>
>>>>>> ie. <parameter
>>>>>> name="messageReceiver.invokeOnSeparateThread">true</parameter>
>>>>>>
>>>>>> if the request contains a replyTo header service invocation happens in
>>>>>> a separate thread.
>>>>>>
>>>>>> thanks,
>>>>>> Amila.
>>>>>>
>>>>>>
>>>>>>
>>>>>>> cheers, Håkon
>>>>>>>
>>>>>>>
>>>>>>> [1] http://www.ibm.com/developerworks/webservices/library/ws-axis2/
>>>>>>>
>>>>>>> --
>>>>>>> Håkon Sagehaug, Scientific Programmer
>>>>>>> Parallab, Bergen Center for Computational Science (BCCS)
>>>>>>> UNIFOB AS (University of Bergen Research Company)
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Amila Suriarachchi
>>>>>> WSO2 Inc.
>>>>>> blog: http://amilachinthaka.blogspot.com/
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Håkon Sagehaug, Scientific Programmer
>>>>> Parallab, Bergen Center for Computational Science (BCCS)
>>>>> UNIFOB AS (University of Bergen Research Company)
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Amila Suriarachchi
>>>> WSO2 Inc.
>>>> blog: http://amilachinthaka.blogspot.com/
>>>>
>>>
>>>
>>>
>>> --
>>> Håkon Sagehaug, Scientific Programmer
>>> Parallab, Bergen Center for Computational Science (BCCS)
>>> UNIFOB AS (University of Bergen Research Company)
>>>
>>
>>
>>
>> --
>> Håkon Sagehaug, Scientific Programmer
>> Parallab, Bergen Center for Computational Science (BCCS)
>> UNIFOB AS (University of Bergen Research Company)
>>
>
>
>
> --
> Håkon Sagehaug, Scientific Programmer
> Parallab, Bergen Center for Computational Science (BCCS)
> UNIFOB AS (University of Bergen Research Company)
>



-- 
Håkon Sagehaug, Scientific Programmer
Parallab, Bergen Center for Computational Science (BCCS)
UNIFOB AS (University of Bergen Research Company)

Re: Creating a async web sercice

Posted by Håkon Sagehaug <Ha...@bccs.uib.no>.
Hi

I changed to axis2 1.5 also on the server and then all seems to work.
Thanks for the help

cheers, Håkon

2009/9/17 Håkon Sagehaug <Ha...@bccs.uib.no>

> Hi
>
> I also get this error message
>
> SEVERE: The Callback for MessageID urn:uuid:E75DBDF30A77DAB1011253193935432
> was not found
> org.apache.axis2.AxisFault: The Callback for MessageID
> urn:uuid:E75DBDF30A77DAB1011253193935432 was not found
>
> cheers, Håkon
>
>
> 2009/9/17 Håkon Sagehaug <Ha...@bccs.uib.no>
>
> Hi
>>
>> I used axis2 1.4.1 and changed to 1.5, but I still got time out. I changed
>> just on the client side, server is still using 1.4.1
>>
>>
>>
>> 2009/9/17 Amila Suriarachchi <am...@gmail.com>
>>
>>> What is the Axis2 version you use? try with Axis2 1.5.
>>>
>>> hope you have set the parameter correctly.
>>>
>> On the server or client side?
>> The service.xml looks like this
>> <service name="EchoService">
>>         <messageReceivers>
>>             <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
>> class="no.uib.bccs.esysbio.echoservice.EchoServiceMessageReceiverInOut"/>
>>         </messageReceivers>
>>
>>         <parameter
>> name="messageReceiver.invokeOnSeparateThread">true</parameter>
>>         <parameter
>> name="ServiceClass">no.uib.bccs.esysbio.echoservice.EchoServiceImpl</parameter>
>>         <parameter name="useOriginalwsdl">true</parameter>
>>         <parameter name="modifyUserWSDLPortAddress">true</parameter>
>>         <operation name="SayHi" mep="http://www.w3.org/ns/wsdl/in-out"
>> namespace="http://www.bccs.uib.no/EchoService.wsdl">
>>             <actionMapping>http://www.bccs.uib.no/EchoService.wsdl/SayHi
>> </actionMapping>
>>             <outputActionMapping>
>> http://www.bccs.uib.no/EchoService.wsdl/EchoServicePortType/SayHiResponse
>> </outputActionMapping>
>>         </operation>
>>     </service>
>>
>> And in my message receiver I print out this
>>
>> Using async Parameter? : messageReceiver.invokeOnSeparateThread=true
>>
>> So to me the server side looks correct, any more tips on the client
>>
>> cheers, Håkon
>>
>>
>>>
>>> thanks,
>>> Amila.
>>>
>>> 2009/9/17 Håkon Sagehaug <Ha...@bccs.uib.no>
>>>
>>> hi
>>>>
>>>> thanks for the tip.
>>>>
>>>> I've added the parameter to the service.xml file. For simulating a
>>>> "long" running ws I 've got a simple echo service where I sleep the thread
>>>> in 1 minute, like this
>>>>
>>>> try {
>>>>         Thread.sleep(60000);
>>>>     } catch (InterruptedException e) {
>>>>         e.printStackTrace();
>>>>     }
>>>>
>>>>
>>>>
>>>> And my client looks like this
>>>>
>>>>
>>>> EchoServiceStub stub;
>>>>     try {
>>>>
>>>>         ConfigurationContext context = ConfigurationContextFactory
>>>>             .createConfigurationContextFromFileSystem("repository",
>>>>                 null);
>>>>
>>>>         stub = new EchoServiceStub(context,
>>>>             "http://localhost:8080/axis2/services/EchoService");
>>>>         stub._getServiceClient().engageModule("addressing");
>>>>
>>>>         EchoServiceCallbackHandler callback = new
>>>> EchoServiceCallbackHandler() {
>>>>
>>>>         public void receiveResultSayHi(SayHiResponse resp) {
>>>>             System.out.print("in callback " + resp.getHiResponse());
>>>>             System.exit(0);
>>>>         }
>>>>
>>>>         public void receiveErrorSayHi(Exception e) {
>>>>             e.printStackTrace();
>>>>
>>>>         }
>>>>         };
>>>>
>>>>
>>>>         SayHi hi = new SayHi();
>>>>         hi.setHi("testu");
>>>>
>>>>
>>>> stub._getServiceClient().getOptions().setUseSeparateListener(true);
>>>>
>>>>         stub.startSayHi(hi, callback);
>>>>     } catch (AxisFault e) {
>>>>         e.printStackTrace();
>>>>     } catch (RemoteException e) {
>>>>         e.printStackTrace();
>>>>     }
>>>>     }
>>>>
>>>> But even when I use separate transport listeners I get
>>>>
>>>> org.apache.axis2.AxisFault: Read timed out
>>>>     at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
>>>>     at
>>>> org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)
>>>>     at
>>>> org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
>>>>     at
>>>> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:371)
>>>>     at
>>>> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:209)
>>>>     at
>>>> org.apache.axis2.engine.AxisEngine$TransportNonBlockingInvocationWorker.run(AxisEngine.java:630)
>>>>     at
>>>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
>>>>     at
>>>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
>>>>     at java.lang.Thread.run(Thread.java:619)
>>>>
>>>> on the client side.
>>>>
>>>> Any more configuration needed on either sides?
>>>>
>>>> cheers, Håkon
>>>>
>>>>
>>>> 2009/9/17 Amila Suriarachchi <am...@gmail.com>
>>>>
>>>>
>>>>>
>>>>> 2009/9/16 Håkon Sagehaug <Ha...@bccs.uib.no>
>>>>>
>>>>>> Hi
>>>>>>
>>>>>>
>>>>>> I wanted to try out to make a web service async, does anyone know of a
>>>>>> cookbook how to do that? I found this link[1] explaning how I want my
>>>>>> service to work. is it the AsyncMessageReceiver  from the integration module
>>>>>> in axis2 svn I should use? Basically I need som help and guide how to enable
>>>>>> async behavior on the server side, I know how to do it on the client side,
>>>>>> for getting a non-blocking using two transport channels.
>>>>>>
>>>>>> any tips or hint on this topic?
>>>>>>
>>>>>
>>>>> you need to set this parameter messageReceiver.invokeOnSeparateThread
>>>>> to true in your service.
>>>>>
>>>>> ie. <parameter
>>>>> name="messageReceiver.invokeOnSeparateThread">true</parameter>
>>>>>
>>>>> if the request contains a replyTo header service invocation happens in
>>>>> a separate thread.
>>>>>
>>>>> thanks,
>>>>> Amila.
>>>>>
>>>>>
>>>>>
>>>>>> cheers, Håkon
>>>>>>
>>>>>>
>>>>>> [1] http://www.ibm.com/developerworks/webservices/library/ws-axis2/
>>>>>>
>>>>>> --
>>>>>> Håkon Sagehaug, Scientific Programmer
>>>>>> Parallab, Bergen Center for Computational Science (BCCS)
>>>>>> UNIFOB AS (University of Bergen Research Company)
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Amila Suriarachchi
>>>>> WSO2 Inc.
>>>>> blog: http://amilachinthaka.blogspot.com/
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Håkon Sagehaug, Scientific Programmer
>>>> Parallab, Bergen Center for Computational Science (BCCS)
>>>> UNIFOB AS (University of Bergen Research Company)
>>>>
>>>
>>>
>>>
>>> --
>>> Amila Suriarachchi
>>> WSO2 Inc.
>>> blog: http://amilachinthaka.blogspot.com/
>>>
>>
>>
>>
>> --
>> Håkon Sagehaug, Scientific Programmer
>> Parallab, Bergen Center for Computational Science (BCCS)
>> UNIFOB AS (University of Bergen Research Company)
>>
>
>
>
> --
> Håkon Sagehaug, Scientific Programmer
> Parallab, Bergen Center for Computational Science (BCCS)
> UNIFOB AS (University of Bergen Research Company)
>



-- 
Håkon Sagehaug, Scientific Programmer
Parallab, Bergen Center for Computational Science (BCCS)
UNIFOB AS (University of Bergen Research Company)

Re: Creating a async web sercice

Posted by Håkon Sagehaug <Ha...@bccs.uib.no>.
Hi

I also get this error message

SEVERE: The Callback for MessageID urn:uuid:E75DBDF30A77DAB1011253193935432
was not found
org.apache.axis2.AxisFault: The Callback for MessageID
urn:uuid:E75DBDF30A77DAB1011253193935432 was not found

cheers, Håkon


2009/9/17 Håkon Sagehaug <Ha...@bccs.uib.no>

> Hi
>
> I used axis2 1.4.1 and changed to 1.5, but I still got time out. I changed
> just on the client side, server is still using 1.4.1
>
>
>
> 2009/9/17 Amila Suriarachchi <am...@gmail.com>
>
>> What is the Axis2 version you use? try with Axis2 1.5.
>>
>> hope you have set the parameter correctly.
>>
> On the server or client side?
> The service.xml looks like this
> <service name="EchoService">
>         <messageReceivers>
>             <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
> class="no.uib.bccs.esysbio.echoservice.EchoServiceMessageReceiverInOut"/>
>         </messageReceivers>
>
>         <parameter
> name="messageReceiver.invokeOnSeparateThread">true</parameter>
>         <parameter
> name="ServiceClass">no.uib.bccs.esysbio.echoservice.EchoServiceImpl</parameter>
>         <parameter name="useOriginalwsdl">true</parameter>
>         <parameter name="modifyUserWSDLPortAddress">true</parameter>
>         <operation name="SayHi" mep="http://www.w3.org/ns/wsdl/in-out"
> namespace="http://www.bccs.uib.no/EchoService.wsdl">
>             <actionMapping>http://www.bccs.uib.no/EchoService.wsdl/SayHi
> </actionMapping>
>             <outputActionMapping>
> http://www.bccs.uib.no/EchoService.wsdl/EchoServicePortType/SayHiResponse
> </outputActionMapping>
>         </operation>
>     </service>
>
> And in my message receiver I print out this
>
> Using async Parameter? : messageReceiver.invokeOnSeparateThread=true
>
> So to me the server side looks correct, any more tips on the client
>
> cheers, Håkon
>
>
>>
>> thanks,
>> Amila.
>>
>> 2009/9/17 Håkon Sagehaug <Ha...@bccs.uib.no>
>>
>> hi
>>>
>>> thanks for the tip.
>>>
>>> I've added the parameter to the service.xml file. For simulating a "long"
>>> running ws I 've got a simple echo service where I sleep the thread in 1
>>> minute, like this
>>>
>>> try {
>>>         Thread.sleep(60000);
>>>     } catch (InterruptedException e) {
>>>         e.printStackTrace();
>>>     }
>>>
>>>
>>>
>>> And my client looks like this
>>>
>>>
>>> EchoServiceStub stub;
>>>     try {
>>>
>>>         ConfigurationContext context = ConfigurationContextFactory
>>>             .createConfigurationContextFromFileSystem("repository",
>>>                 null);
>>>
>>>         stub = new EchoServiceStub(context,
>>>             "http://localhost:8080/axis2/services/EchoService");
>>>         stub._getServiceClient().engageModule("addressing");
>>>
>>>         EchoServiceCallbackHandler callback = new
>>> EchoServiceCallbackHandler() {
>>>
>>>         public void receiveResultSayHi(SayHiResponse resp) {
>>>             System.out.print("in callback " + resp.getHiResponse());
>>>             System.exit(0);
>>>         }
>>>
>>>         public void receiveErrorSayHi(Exception e) {
>>>             e.printStackTrace();
>>>
>>>         }
>>>         };
>>>
>>>
>>>         SayHi hi = new SayHi();
>>>         hi.setHi("testu");
>>>
>>>
>>> stub._getServiceClient().getOptions().setUseSeparateListener(true);
>>>
>>>         stub.startSayHi(hi, callback);
>>>     } catch (AxisFault e) {
>>>         e.printStackTrace();
>>>     } catch (RemoteException e) {
>>>         e.printStackTrace();
>>>     }
>>>     }
>>>
>>> But even when I use separate transport listeners I get
>>>
>>> org.apache.axis2.AxisFault: Read timed out
>>>     at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
>>>     at
>>> org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)
>>>     at
>>> org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
>>>     at
>>> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:371)
>>>     at
>>> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:209)
>>>     at
>>> org.apache.axis2.engine.AxisEngine$TransportNonBlockingInvocationWorker.run(AxisEngine.java:630)
>>>     at
>>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
>>>     at
>>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
>>>     at java.lang.Thread.run(Thread.java:619)
>>>
>>> on the client side.
>>>
>>> Any more configuration needed on either sides?
>>>
>>> cheers, Håkon
>>>
>>>
>>> 2009/9/17 Amila Suriarachchi <am...@gmail.com>
>>>
>>>
>>>>
>>>> 2009/9/16 Håkon Sagehaug <Ha...@bccs.uib.no>
>>>>
>>>>> Hi
>>>>>
>>>>>
>>>>> I wanted to try out to make a web service async, does anyone know of a
>>>>> cookbook how to do that? I found this link[1] explaning how I want my
>>>>> service to work. is it the AsyncMessageReceiver  from the integration module
>>>>> in axis2 svn I should use? Basically I need som help and guide how to enable
>>>>> async behavior on the server side, I know how to do it on the client side,
>>>>> for getting a non-blocking using two transport channels.
>>>>>
>>>>> any tips or hint on this topic?
>>>>>
>>>>
>>>> you need to set this parameter messageReceiver.invokeOnSeparateThread to
>>>> true in your service.
>>>>
>>>> ie. <parameter
>>>> name="messageReceiver.invokeOnSeparateThread">true</parameter>
>>>>
>>>> if the request contains a replyTo header service invocation happens in a
>>>> separate thread.
>>>>
>>>> thanks,
>>>> Amila.
>>>>
>>>>
>>>>
>>>>> cheers, Håkon
>>>>>
>>>>>
>>>>> [1] http://www.ibm.com/developerworks/webservices/library/ws-axis2/
>>>>>
>>>>> --
>>>>> Håkon Sagehaug, Scientific Programmer
>>>>> Parallab, Bergen Center for Computational Science (BCCS)
>>>>> UNIFOB AS (University of Bergen Research Company)
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Amila Suriarachchi
>>>> WSO2 Inc.
>>>> blog: http://amilachinthaka.blogspot.com/
>>>>
>>>
>>>
>>>
>>> --
>>> Håkon Sagehaug, Scientific Programmer
>>> Parallab, Bergen Center for Computational Science (BCCS)
>>> UNIFOB AS (University of Bergen Research Company)
>>>
>>
>>
>>
>> --
>> Amila Suriarachchi
>> WSO2 Inc.
>> blog: http://amilachinthaka.blogspot.com/
>>
>
>
>
> --
> Håkon Sagehaug, Scientific Programmer
> Parallab, Bergen Center for Computational Science (BCCS)
> UNIFOB AS (University of Bergen Research Company)
>



-- 
Håkon Sagehaug, Scientific Programmer
Parallab, Bergen Center for Computational Science (BCCS)
UNIFOB AS (University of Bergen Research Company)

Re: Creating a async web sercice

Posted by Håkon Sagehaug <Ha...@bccs.uib.no>.
Hi

I used axis2 1.4.1 and changed to 1.5, but I still got time out. I changed
just on the client side, server is still using 1.4.1



2009/9/17 Amila Suriarachchi <am...@gmail.com>

> What is the Axis2 version you use? try with Axis2 1.5.
>
> hope you have set the parameter correctly.
>
On the server or client side?
The service.xml looks like this
<service name="EchoService">
        <messageReceivers>
            <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
class="no.uib.bccs.esysbio.echoservice.EchoServiceMessageReceiverInOut"/>
        </messageReceivers>

        <parameter
name="messageReceiver.invokeOnSeparateThread">true</parameter>
        <parameter
name="ServiceClass">no.uib.bccs.esysbio.echoservice.EchoServiceImpl</parameter>
        <parameter name="useOriginalwsdl">true</parameter>
        <parameter name="modifyUserWSDLPortAddress">true</parameter>
        <operation name="SayHi" mep="http://www.w3.org/ns/wsdl/in-out"
namespace="http://www.bccs.uib.no/EchoService.wsdl">
            <actionMapping>http://www.bccs.uib.no/EchoService.wsdl/SayHi
</actionMapping>
            <outputActionMapping>
http://www.bccs.uib.no/EchoService.wsdl/EchoServicePortType/SayHiResponse
</outputActionMapping>
        </operation>
    </service>

And in my message receiver I print out this

Using async Parameter? : messageReceiver.invokeOnSeparateThread=true

So to me the server side looks correct, any more tips on the client

cheers, Håkon


>
> thanks,
> Amila.
>
> 2009/9/17 Håkon Sagehaug <Ha...@bccs.uib.no>
>
> hi
>>
>> thanks for the tip.
>>
>> I've added the parameter to the service.xml file. For simulating a "long"
>> running ws I 've got a simple echo service where I sleep the thread in 1
>> minute, like this
>>
>> try {
>>         Thread.sleep(60000);
>>     } catch (InterruptedException e) {
>>         e.printStackTrace();
>>     }
>>
>>
>>
>> And my client looks like this
>>
>>
>> EchoServiceStub stub;
>>     try {
>>
>>         ConfigurationContext context = ConfigurationContextFactory
>>             .createConfigurationContextFromFileSystem("repository",
>>                 null);
>>
>>         stub = new EchoServiceStub(context,
>>             "http://localhost:8080/axis2/services/EchoService");
>>         stub._getServiceClient().engageModule("addressing");
>>
>>         EchoServiceCallbackHandler callback = new
>> EchoServiceCallbackHandler() {
>>
>>         public void receiveResultSayHi(SayHiResponse resp) {
>>             System.out.print("in callback " + resp.getHiResponse());
>>             System.exit(0);
>>         }
>>
>>         public void receiveErrorSayHi(Exception e) {
>>             e.printStackTrace();
>>
>>         }
>>         };
>>
>>
>>         SayHi hi = new SayHi();
>>         hi.setHi("testu");
>>
>>
>> stub._getServiceClient().getOptions().setUseSeparateListener(true);
>>
>>         stub.startSayHi(hi, callback);
>>     } catch (AxisFault e) {
>>         e.printStackTrace();
>>     } catch (RemoteException e) {
>>         e.printStackTrace();
>>     }
>>     }
>>
>> But even when I use separate transport listeners I get
>>
>> org.apache.axis2.AxisFault: Read timed out
>>     at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
>>     at
>> org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)
>>     at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
>>     at
>> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:371)
>>     at
>> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:209)
>>     at
>> org.apache.axis2.engine.AxisEngine$TransportNonBlockingInvocationWorker.run(AxisEngine.java:630)
>>     at
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
>>     at
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
>>     at java.lang.Thread.run(Thread.java:619)
>>
>> on the client side.
>>
>> Any more configuration needed on either sides?
>>
>> cheers, Håkon
>>
>>
>> 2009/9/17 Amila Suriarachchi <am...@gmail.com>
>>
>>
>>>
>>> 2009/9/16 Håkon Sagehaug <Ha...@bccs.uib.no>
>>>
>>>> Hi
>>>>
>>>>
>>>> I wanted to try out to make a web service async, does anyone know of a
>>>> cookbook how to do that? I found this link[1] explaning how I want my
>>>> service to work. is it the AsyncMessageReceiver  from the integration module
>>>> in axis2 svn I should use? Basically I need som help and guide how to enable
>>>> async behavior on the server side, I know how to do it on the client side,
>>>> for getting a non-blocking using two transport channels.
>>>>
>>>> any tips or hint on this topic?
>>>>
>>>
>>> you need to set this parameter messageReceiver.invokeOnSeparateThread to
>>> true in your service.
>>>
>>> ie. <parameter
>>> name="messageReceiver.invokeOnSeparateThread">true</parameter>
>>>
>>> if the request contains a replyTo header service invocation happens in a
>>> separate thread.
>>>
>>> thanks,
>>> Amila.
>>>
>>>
>>>
>>>> cheers, Håkon
>>>>
>>>>
>>>> [1] http://www.ibm.com/developerworks/webservices/library/ws-axis2/
>>>>
>>>> --
>>>> Håkon Sagehaug, Scientific Programmer
>>>> Parallab, Bergen Center for Computational Science (BCCS)
>>>> UNIFOB AS (University of Bergen Research Company)
>>>>
>>>
>>>
>>>
>>> --
>>> Amila Suriarachchi
>>> WSO2 Inc.
>>> blog: http://amilachinthaka.blogspot.com/
>>>
>>
>>
>>
>> --
>> Håkon Sagehaug, Scientific Programmer
>> Parallab, Bergen Center for Computational Science (BCCS)
>> UNIFOB AS (University of Bergen Research Company)
>>
>
>
>
> --
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
>



-- 
Håkon Sagehaug, Scientific Programmer
Parallab, Bergen Center for Computational Science (BCCS)
UNIFOB AS (University of Bergen Research Company)

Re: Creating a async web sercice

Posted by Amila Suriarachchi <am...@gmail.com>.
What is the Axis2 version you use? try with Axis2 1.5.

hope you have set the parameter correctly.

thanks,
Amila.

2009/9/17 Håkon Sagehaug <Ha...@bccs.uib.no>

> hi
>
> thanks for the tip.
>
> I've added the parameter to the service.xml file. For simulating a "long"
> running ws I 've got a simple echo service where I sleep the thread in 1
> minute, like this
>
> try {
>         Thread.sleep(60000);
>     } catch (InterruptedException e) {
>         e.printStackTrace();
>     }
>
>
>
> And my client looks like this
>
>
> EchoServiceStub stub;
>     try {
>
>         ConfigurationContext context = ConfigurationContextFactory
>             .createConfigurationContextFromFileSystem("repository",
>                 null);
>
>         stub = new EchoServiceStub(context,
>             "http://localhost:8080/axis2/services/EchoService");
>         stub._getServiceClient().engageModule("addressing");
>
>         EchoServiceCallbackHandler callback = new
> EchoServiceCallbackHandler() {
>
>         public void receiveResultSayHi(SayHiResponse resp) {
>             System.out.print("in callback " + resp.getHiResponse());
>             System.exit(0);
>         }
>
>         public void receiveErrorSayHi(Exception e) {
>             e.printStackTrace();
>
>         }
>         };
>
>
>         SayHi hi = new SayHi();
>         hi.setHi("testu");
>
>         stub._getServiceClient().getOptions().setUseSeparateListener(true);
>
>         stub.startSayHi(hi, callback);
>     } catch (AxisFault e) {
>         e.printStackTrace();
>     } catch (RemoteException e) {
>         e.printStackTrace();
>     }
>     }
>
> But even when I use separate transport listeners I get
>
> org.apache.axis2.AxisFault: Read timed out
>     at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
>     at
> org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)
>     at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
>     at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:371)
>     at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:209)
>     at
> org.apache.axis2.engine.AxisEngine$TransportNonBlockingInvocationWorker.run(AxisEngine.java:630)
>     at
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
>     at
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
>     at java.lang.Thread.run(Thread.java:619)
>
> on the client side.
>
> Any more configuration needed on either sides?
>
> cheers, Håkon
>
>
> 2009/9/17 Amila Suriarachchi <am...@gmail.com>
>
>
>>
>> 2009/9/16 Håkon Sagehaug <Ha...@bccs.uib.no>
>>
>>> Hi
>>>
>>>
>>> I wanted to try out to make a web service async, does anyone know of a
>>> cookbook how to do that? I found this link[1] explaning how I want my
>>> service to work. is it the AsyncMessageReceiver  from the integration module
>>> in axis2 svn I should use? Basically I need som help and guide how to enable
>>> async behavior on the server side, I know how to do it on the client side,
>>> for getting a non-blocking using two transport channels.
>>>
>>> any tips or hint on this topic?
>>>
>>
>> you need to set this parameter messageReceiver.invokeOnSeparateThread to
>> true in your service.
>>
>> ie. <parameter
>> name="messageReceiver.invokeOnSeparateThread">true</parameter>
>>
>> if the request contains a replyTo header service invocation happens in a
>> separate thread.
>>
>> thanks,
>> Amila.
>>
>>
>>
>>> cheers, Håkon
>>>
>>>
>>> [1] http://www.ibm.com/developerworks/webservices/library/ws-axis2/
>>>
>>> --
>>> Håkon Sagehaug, Scientific Programmer
>>> Parallab, Bergen Center for Computational Science (BCCS)
>>> UNIFOB AS (University of Bergen Research Company)
>>>
>>
>>
>>
>> --
>> Amila Suriarachchi
>> WSO2 Inc.
>> blog: http://amilachinthaka.blogspot.com/
>>
>
>
>
> --
> Håkon Sagehaug, Scientific Programmer
> Parallab, Bergen Center for Computational Science (BCCS)
> UNIFOB AS (University of Bergen Research Company)
>



-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Re: Creating a async web sercice

Posted by Håkon Sagehaug <Ha...@bccs.uib.no>.
hi

thanks for the tip.

I've added the parameter to the service.xml file. For simulating a "long"
running ws I 've got a simple echo service where I sleep the thread in 1
minute, like this

try {
        Thread.sleep(60000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }



And my client looks like this


EchoServiceStub stub;
    try {

        ConfigurationContext context = ConfigurationContextFactory
            .createConfigurationContextFromFileSystem("repository",
                null);

        stub = new EchoServiceStub(context,
            "http://localhost:8080/axis2/services/EchoService");
        stub._getServiceClient().engageModule("addressing");

        EchoServiceCallbackHandler callback = new
EchoServiceCallbackHandler() {

        public void receiveResultSayHi(SayHiResponse resp) {
            System.out.print("in callback " + resp.getHiResponse());
            System.exit(0);
        }

        public void receiveErrorSayHi(Exception e) {
            e.printStackTrace();

        }
        };


        SayHi hi = new SayHi();
        hi.setHi("testu");

        stub._getServiceClient().getOptions().setUseSeparateListener(true);

        stub.startSayHi(hi, callback);
    } catch (AxisFault e) {
        e.printStackTrace();
    } catch (RemoteException e) {
        e.printStackTrace();
    }
    }

But even when I use separate transport listeners I get

org.apache.axis2.AxisFault: Read timed out
    at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
    at
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)
    at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
    at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:371)
    at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:209)
    at
org.apache.axis2.engine.AxisEngine$TransportNonBlockingInvocationWorker.run(AxisEngine.java:630)
    at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
    at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
    at java.lang.Thread.run(Thread.java:619)

on the client side.

Any more configuration needed on either sides?

cheers, Håkon


2009/9/17 Amila Suriarachchi <am...@gmail.com>

>
>
> 2009/9/16 Håkon Sagehaug <Ha...@bccs.uib.no>
>
>> Hi
>>
>>
>> I wanted to try out to make a web service async, does anyone know of a
>> cookbook how to do that? I found this link[1] explaning how I want my
>> service to work. is it the AsyncMessageReceiver  from the integration module
>> in axis2 svn I should use? Basically I need som help and guide how to enable
>> async behavior on the server side, I know how to do it on the client side,
>> for getting a non-blocking using two transport channels.
>>
>> any tips or hint on this topic?
>>
>
> you need to set this parameter messageReceiver.invokeOnSeparateThread to
> true in your service.
>
> ie. <parameter
> name="messageReceiver.invokeOnSeparateThread">true</parameter>
>
> if the request contains a replyTo header service invocation happens in a
> separate thread.
>
> thanks,
> Amila.
>
>
>
>> cheers, Håkon
>>
>>
>> [1] http://www.ibm.com/developerworks/webservices/library/ws-axis2/
>>
>> --
>> Håkon Sagehaug, Scientific Programmer
>> Parallab, Bergen Center for Computational Science (BCCS)
>> UNIFOB AS (University of Bergen Research Company)
>>
>
>
>
> --
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
>



-- 
Håkon Sagehaug, Scientific Programmer
Parallab, Bergen Center for Computational Science (BCCS)
UNIFOB AS (University of Bergen Research Company)

Re: Creating a async web sercice

Posted by Amila Suriarachchi <am...@gmail.com>.
2009/9/16 Håkon Sagehaug <Ha...@bccs.uib.no>

> Hi
>
>
> I wanted to try out to make a web service async, does anyone know of a
> cookbook how to do that? I found this link[1] explaning how I want my
> service to work. is it the AsyncMessageReceiver  from the integration module
> in axis2 svn I should use? Basically I need som help and guide how to enable
> async behavior on the server side, I know how to do it on the client side,
> for getting a non-blocking using two transport channels.
>
> any tips or hint on this topic?
>

you need to set this parameter messageReceiver.invokeOnSeparateThread to
true in your service.

ie. <parameter
name="messageReceiver.invokeOnSeparateThread">true</parameter>

if the request contains a replyTo header service invocation happens in a
separate thread.

thanks,
Amila.



> cheers, Håkon
>
>
> [1] http://www.ibm.com/developerworks/webservices/library/ws-axis2/
>
> --
> Håkon Sagehaug, Scientific Programmer
> Parallab, Bergen Center for Computational Science (BCCS)
> UNIFOB AS (University of Bergen Research Company)
>



-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/