axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Håkon Sagehaug <Hakon.Sageh...@bccs.uib.no>
Subject Re: Creating a async web sercice
Date Thu, 17 Sep 2009 09:26:06 GMT
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 <amilasuriarachchi@gmail.com>

>
>
> 2009/9/16 Håkon Sagehaug <Hakon.Sagehaug@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)

Mime
View raw message