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 Adil Allawi <ad...@diwan.com> on 2011/04/01 18:44:09 UTC

Pointers for building an asynchronous web service

Can anyone recommend a tutorials with working samples to show how to 
build an asynchronous web service using axis2. Something that actually 
runs and works with Axis 2 1.5.4. There are a lot of articles out there 
but most are out-dated and/or only have incomplete code snippets.

Here is what I am trying to do: I have a web service that takes a long 
time to complete. What I need to do have this run asynchronously on the 
server and then return the results to the client in a separate Listener. 
I am starting with a wsdl file and using wsdl2java to generate the 
client and server code (options -a -sd -ss). Running async on the client 
works fine but I cannot get it to run async on the server.

I know I have to add:

             stub._getServiceClient().engageModule("addressing");
             
stub._getServiceClient().getOptions().setUseSeparateListener(true);

to the client.

And also to add:

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

to services.xml.

But, I notice that my service skeleton class is still being called 
synchronously. The problem is that AbstractMessageReceiver.recieve() is 
not calling it in a thread because the message context replyTo is null. 
So the service is still being called synchronously. Also the client is 
not receiving a response - I expect this to be because the client 
expects the server to respond asynchronously.

Thanks

Adil

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


Re: AW: Pointers for building an asynchronous web service

Posted by Adil Allawi <ad...@diwan.com>.
It is simpler than that. I want to use the asynchronous server feature 
of Axis2. On the client, Axis2 launches a simple http service to wait 
for the response (the separate listener) and on the server side, axis2 
invokes the business logic of the web service on a new thread which 
returns its results to the separate listener on the client.

see 
http://www.ibm.com/developerworks/webservices/library/ws-axis2/#N10147 
for a better explaination of what I need.

thanks

Adil

On 04/04/2011 10:35, Stadelmann Josef wrote:
> What do you mean with running asynchronous at the server?
> Are you saying that you have a lot of threads implementing the service
> And that each thread end has to be reported to the client some way?
> Josef
>
> -----Ursprüngliche Nachricht-----
> Von: Adil Allawi [mailto:adil@diwan.com]
> Gesendet: Freitag, 1. April 2011 18:44
> An: java-user@axis.apache.org
> Betreff: Pointers for building an asynchronous web service
>
> Can anyone recommend a tutorials with working samples to show how to
> build an asynchronous web service using axis2. Something that actually
> runs and works with Axis 2 1.5.4. There are a lot of articles out there
> but most are out-dated and/or only have incomplete code snippets.
>
> Here is what I am trying to do: I have a web service that takes a long
> time to complete. What I need to do have this run asynchronously on the
> server and then return the results to the client in a separate Listener.
> I am starting with a wsdl file and using wsdl2java to generate the
> client and server code (options -a -sd -ss). Running async on the client
> works fine but I cannot get it to run async on the server.
>
> I know I have to add:
>
>               stub._getServiceClient().engageModule("addressing");
>
> stub._getServiceClient().getOptions().setUseSeparateListener(true);
>
> to the client.
>
> And also to add:
>
> <parameter name="messageReceiver.invokeOnSeparateThread">true</parameter>
>
> to services.xml.
>
> But, I notice that my service skeleton class is still being called
> synchronously. The problem is that AbstractMessageReceiver.recieve() is
> not calling it in a thread because the message context replyTo is null.
> So the service is still being called synchronously. Also the client is
> not receiving a response - I expect this to be because the client
> expects the server to respond asynchronously.
>
> Thanks
>
> Adil
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>

-- 
--------------------------------------------

Adil Allawi
Diwan Software Ltd.
37-39 Peckham Road,
London SE5 8UH, U.K.

Mobile: +44 (0)7718 785 850
mailto:adil@diwan.com
http://www.diwan.com/


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


AW: Pointers for building an asynchronous web service

Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
What do you mean with running asynchronous at the server?
Are you saying that you have a lot of threads implementing the service
And that each thread end has to be reported to the client some way?
Josef

-----Ursprüngliche Nachricht-----
Von: Adil Allawi [mailto:adil@diwan.com] 
Gesendet: Freitag, 1. April 2011 18:44
An: java-user@axis.apache.org
Betreff: Pointers for building an asynchronous web service

Can anyone recommend a tutorials with working samples to show how to 
build an asynchronous web service using axis2. Something that actually 
runs and works with Axis 2 1.5.4. There are a lot of articles out there 
but most are out-dated and/or only have incomplete code snippets.

Here is what I am trying to do: I have a web service that takes a long 
time to complete. What I need to do have this run asynchronously on the 
server and then return the results to the client in a separate Listener. 
I am starting with a wsdl file and using wsdl2java to generate the 
client and server code (options -a -sd -ss). Running async on the client 
works fine but I cannot get it to run async on the server.

I know I have to add:

             stub._getServiceClient().engageModule("addressing");
             
stub._getServiceClient().getOptions().setUseSeparateListener(true);

to the client.

And also to add:

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

to services.xml.

But, I notice that my service skeleton class is still being called 
synchronously. The problem is that AbstractMessageReceiver.recieve() is 
not calling it in a thread because the message context replyTo is null. 
So the service is still being called synchronously. Also the client is 
not receiving a response - I expect this to be because the client 
expects the server to respond asynchronously.

Thanks

Adil

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