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 Axis User <us...@yahoo.com> on 2007/11/16 18:32:28 UTC

Does non-blocking / Async in AXIS2 really work ?

Hi there,
 
I have AXIS2 release 1.3 installed (on PC, Windows XP)
I compile and deploy the ECHO service from \axis2\samples\userguide\src\userguide\example1 (MyService.java)
I start the server from \axis2\bin\axis2server.bat
I compile and run different  clients from \axis2\samples\userguide\src\userguide\clients
Everything works fine and I can run different clients and request is sent to server and response comes back.
Now I want to test the Async (non-blocking) aspect of Axis2:
 
In server code in echo() function I put a thread sleep so that it keeps it busy before returning to client and I am expecting that Axis2 engine will take care of non-blocking aspect and will return back to Client in another channel (non-blocking async dual channel client) :
 
I put below Thread sleep in server code in Echo() function:
 
public class MyService {
    public OMElement echo(OMElement element) throws XMLStreamException 
   {
        element.build();
        element.detach();
          
        //This is put with Try/Catch but is removed here to see it better
        Thread.sleep(60000);
          
        return element;
    }
  
So when I run the client the server will simulate doing a job of 60 seconds (1 minute) which is more than the default Axis2 timeout of 30 seconds. What I would expect to see on client side is :
 
OK - 1) If Sync client is run it should timeout as axis2 timeout is 30s and the server is not done with its job. So I run the EchoBlockingClient.java that's what I see it means it times out and the FAULT() function in client is called. So far so good.
 
Not OK - 2) If Async(non-blocking dual or regular) is run I would expect that finaly I will receive the complete method of Client called (onComplete()) but it doesn't happen. I only get onError() or Axis.Fault() called.
 
It means I assume that when I run the example EchoNonBlockingDualClient.java it is going to use 2 HTTP transport channels. The first one should timeout during request but the second one should be used when responese is sent back after 60seconds. 
 
But what happens is after 30 seconds the onError() function :
 
  public void onError(Exception e)
 
inside Callback class is called. Then it just hangs and when the sleep on server side wakes up after 60 seconds I don't receive any callback anymore on Client side. 
 
In case of EchoNonBlockingDualClient.java the thread (eclipse IDE) or Dos Prompt is still active and waiting but in case of EchoNonBlockingClient.java the thread dies and you get the Dos Prompt released.
 
I checked this article :
http://www.ibm.com/developerworks/webservices/library/ws-axis2/
 
And tried to play with services.xml with below:
 
Listing 4. Associating message receivers with the IN-OUT MEP variable
                
<messageReceivers>
    // other message receivers 
   <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class=
      "org.apache.axis2.async.AsyncMessageReceiver"/>
</messageReceivers>
 
But I get class not found error for org.apache.axis2.async.AsyncMessageReceiver. So probably this article is old and this class doesn't exist anymore in new Axis release ?
 
I tried the code in this article:
http://www.onjava.com/lpt/a/6076
 
But most probably this article is old too as I get error in eclipse that it can't resolve this clas CALL :
 
Call call = new Call();
 
And nothing to import.
 
In eclipse I also get depreciated warning for the included client code for Callback:
 
   Callback callback = new Callback()
 
I even change it to AxisCallback class in stead and its methods and run it but still same problem I only get one callback which is during axis2 timeout.
 
So Question:
Has anybody got this non-blocking working? 
 
[I mean make it working when your server job is longer than the Axis2 timeout, as we have a lot of tasks which will take half a day or day etc and we want to return to client longer than Axis2 timeout. I know you can change the Axis2 timeout to maximum 6 days or so (maximum of int) but that's not a good solution as we want to have network timeout in place don't want to wait 6 days if it's network problem but our job might take longer than 6 days or so]
 
Best Regards,
Jan


      ____________________________________________________________________________________
Be a better pen pal. 
Text or chat with friends inside Yahoo! Mail. See how.  http://overview.mail.yahoo.com/

Re: Does non-blocking / Async in AXIS2 really work ?

Posted by Rick Isaacs <re...@gmail.com>.
Hi Jan,

I have also been having problems with the Axis2 /userguide sync dual sample

I tried the developerworks sample with the same results.

I got the dual sample to work,but it hangs after receiving the response.

See my post 2007-11-19 "Axis2 Sample EchoBlockingDualClient - Working
a little better, but hangs"

I am still trying to get the sample to terminate after receiving the response.

Rick


On Nov 16, 2007 6:32 PM, Axis User <us...@yahoo.com> wrote:
>
>
>
> Hi there,
>
>
> I have AXIS2 release 1.3 installed (on PC, Windows XP)
> I compile and deploy the ECHO service from
> \axis2\samples\userguide\src\userguide\example1 (MyService.java)
> I start the server from \axis2\bin\axis2server.bat
> I compile and run different  clients from
> \axis2\samples\userguide\src\userguide\clients
> Everything works fine and I can run different clients and request is sent to
> server and response comes back.
>
> Now I want to test the Async (non-blocking) aspect of Axis2:
>
>
>
> In server code in echo() function I put a thread sleep so that it keeps it
> busy before returning to client and I am expecting that Axis2 engine will
> take care of non-blocking aspect and will return back to Client in another
> channel (non-blocking async dual channel client) :
>
>
>
> I put below Thread sleep in server code in Echo() function:
>
>
>
> public class MyService {
>     public OMElement echo(OMElement element) throws XMLStreamException
>
>    {
>
>         element.build();
>
>         element.detach();
>
>         //This is put with Try/Catch but is removed here to see it better
>         Thread.sleep(60000);
>
>
>         return element;
>     }
>
>
> So when I run the client the server will simulate doing a job of 60 seconds
> (1 minute) which is more than the default Axis2 timeout of 30 seconds. What
> I would expect to see on client side is :
>
> OK - 1) If Sync client is run it should timeout as axis2 timeout is 30s and
> the server is not done with its job. So I run the EchoBlockingClient.java
> that's what I see it means it times out and the FAULT() function in client
> is called. So far so good.
>
> Not OK - 2) If Async(non-blocking dual or regular) is run I would expect
> that finaly I will receive the complete method of Client called
> (onComplete()) but it doesn't happen. I only get onError() or Axis.Fault()
> called.
>
> It means I assume that when I run the example EchoNonBlockingDualClient.java
> it is going to use 2 HTTP transport channels. The first one should timeout
> during request but the second one should be used when responese is sent back
> after 60seconds.
>
> But what happens is after 30 seconds the onError() function :
>
>   public void onError(Exception e)
>
> inside Callback class is called. Then it just hangs and when the sleep on
> server side wakes up after 60 seconds I don't receive any callback anymore
> on Client side.
>
> In case of EchoNonBlockingDualClient.java the thread (eclipse IDE) or Dos
> Prompt is still active and waiting but in case of EchoNonBlockingClient.java
> the thread dies and you get the Dos Prompt released.
>
> I checked this article :
> http://www.ibm.com/developerworks/webservices/library/ws-axis2/
>
> And tried to play with services.xml with below:
>
> Listing 4. Associating message receivers with the IN-OUT MEP variable
>
> <messageReceivers>
>     // other message receivers
>    <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class=
>       "org.apache.axis2.async.AsyncMessageReceiver"/>
> </messageReceivers>
>
> But I get class not found error for
> org.apache.axis2.async.AsyncMessageReceiver. So probably this article is old
> and this class doesn't exist anymore in new Axis release ?
>
> I tried the code in this article:
> http://www.onjava.com/lpt/a/6076
>
> But most probably this article is old too as I get error in eclipse that it
> can't resolve this clas CALL :
>
> Call call = new Call();
>
> And nothing to import.
>
> In eclipse I also get depreciated warning for the included client code for
> Callback:
>
>    Callback callback = new Callback()
>
> I even change it to AxisCallback class in stead and its methods and run it
> but still same problem I only get one callback which is during axis2
> timeout.
>
> So Question:
> Has anybody got this non-blocking working?
>
> [I mean make it working when your server job is longer than the Axis2
> timeout, as we have a lot of tasks which will take half a day or day etc and
> we want to return to client longer than Axis2 timeout. I know you can change
> the Axis2 timeout to maximum 6 days or so (maximum of int) but that's not a
> good solution as we want to have network timeout in place don't want to wait
> 6 days if it's network problem but our job might take longer than 6 days or
> so]
>
> Best Regards,
> Jan
>
>
>
>
>  ________________________________
> Get easy, one-click access to your favorites. Make Yahoo! your homepage.

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


Re: Does non-blocking / Async in AXIS2 really work ?

Posted by Paul Fremantle <pz...@gmail.com>.
Jan

There are two separate issues in asynchronous webservices.

The first is whether the client code blocks and waits. The second is whether
the transport level is asynchronous.These two things are independent.

The client is whether you use a callback, and the transport is whether you
call

serviceClient.setUseSeparateListener(true);

This requires WS Addressing because the server needs a signal to detach the
client socket and it needs the address to recontact the client on.

You cannot bypass the socket timeout without this.

To make the scenario you are using work you need to have both asynchronous
client (so the client thread does not wait) asynchronous transport (so the
socket doesn't timeout, and asynchronous message listener (so that the
server can instantly reply HTTP 202 Accepted to the client. In this scenario
it will work fine and yes Axis2 does work. However, I think the samples
probably need some work to show this.

Paul


On Nov 16, 2007 5:32 PM, Axis User <us...@yahoo.com> wrote:

>  Hi there,
>
>
>    - I have AXIS2 release 1.3 installed (on PC, Windows XP)
>    - I compile and deploy the ECHO service from
>    \axis2\samples\userguide\src\userguide\example1 (MyService.java)
>    - I start the server from \axis2\bin\axis2server.bat
>    - I compile and run different  clients from
>    \axis2\samples\userguide\src\userguide\clients
>    - Everything works fine and I can run different clients and request
>    is sent to server and response comes back.
>
> Now I want to test the Async (non-blocking) aspect of Axis2:
>
>
>
> In server code in echo() function I put a thread sleep so that it keeps it
> busy before returning to client and I am expecting that Axis2 engine will
> take care of non-blocking aspect and will return back to Client in another
> channel (non-blocking async dual channel client) :
>
>
>
> I put below Thread sleep in server code in Echo() function:
>
>
>
> public class MyService {
>     public OMElement *echo*(OMElement element) throws XMLStreamException
>
>    {
>
>         element.build();
>
>         element.detach();
>
> *        //This is put with Try/Catch but is removed here to see it better
>         Thread.sleep(60000);
> *
>
>         return element;
>     }
>
>
> So when I run the client the server will simulate doing a job of 60
> seconds (1 minute) which is more than the default Axis2 timeout of 30
> seconds. What I would expect to see on client side is :
>
> *OK -* 1) If Sync client is run it should timeout as axis2 timeout is 30s
> and the server is not done with its job. So I run the
> EchoBlockingClient.java that's what I see it means it times out and the
> FAULT() function in client is called. So far so good.
>
> *Not OK* - 2) If Async(non-blocking dual or regular) is run I would expect
> that finaly I will receive the complete method of Client called
> (onComplete()) but it doesn't happen. I only get onError() or Axis.Fault()
> called.
>
> It means I assume that when I run the example
> EchoNonBlockingDualClient.java it is going to use 2 HTTP transport
> channels. The first one should timeout during request but the second one
> should be used when responese is sent back after 60seconds.
>
> But what happens is after 30 seconds the onError() function :
>
>   public void onError(Exception e)
>
> inside Callback class is called. Then it just hangs and when the sleep on
> server side wakes up after 60 seconds I don't receive any callback anymore
> on Client side.
>
> In case of EchoNonBlockingDualClient.java the thread (eclipse IDE) or Dos
> Prompt is still active and waiting but in case of
> EchoNonBlockingClient.java the thread dies and you get the Dos Prompt
> released.
>
> I checked this article :
> http://www.ibm.com/developerworks/webservices/library/ws-axis2/
>
> And tried to play with services.xml with below:
>
> Listing 4. Associating message receivers with the IN-OUT MEP variable
>
> <messageReceivers>
>     // other message receivers
>    <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class=
>       "org.apache.axis2.async.AsyncMessageReceiver"/>
> </messageReceivers>
>
> But I get class not found error for
> org.apache.axis2.async.AsyncMessageReceiver. So probably this article is
> old and this class doesn't exist anymore in new Axis release ?
>
> I tried the code in this article:
> http://www.onjava.com/lpt/a/6076
>
> But most probably this article is old too as I get error in eclipse that
> it can't resolve this clas CALL :
>
> Call call = new Call();
>
> And nothing to import.
>
> In eclipse I also get depreciated warning for the included client code for
> Callback:
>
>    Callback callback = new Callback()
>
> I even change it to AxisCallback class in stead and its methods and run it
> but still same problem I only get one callback which is during axis2
> timeout.
>
> *So Question*:
> Has anybody got this non-blocking working?
>
> [I mean make it working when your server job is longer than the Axis2
> timeout, as we have a lot of tasks which will take half a day or day etc and
> we want to return to client longer than Axis2 timeout. I know you can change
> the Axis2 timeout to maximum 6 days or so (maximum of int) but that's not a
> good solution as we want to have network timeout in place don't want to wait
> 6 days if it's network problem but our job might take longer than 6 days or
> so]
>
> Best Regards,
> Jan
>
>
>
> ------------------------------
> Get easy, one-click access to your favorites. Make Yahoo! your homepage.<http://us.rd.yahoo.com/evt=51443/*http://www.yahoo.com/r/hs>
>



-- 
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com