axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "keith chapman" <keithgchap...@gmail.com>
Subject Re: Client times out before getting back the response
Date Mon, 29 Sep 2008 18:16:18 GMT
If you are using service client API then you could try the following, I have
written this client for the version service running on mooshup.com which is
a running instance of the WSO2 Mashup Server [1]

public static void main(String[] args)
            throws RemoteException, StudentNotFoundExceptionException1,
InterruptedException {
        ServiceClient client = new ServiceClient();
        Options options = new Options();
        options.setTo(new EndpointReference("
https://mooshup.com/services/system/version"));
        options.setAction("
http://services.mashup.wso2.org/version/ServiceInterface/getVersionRequest
");
        client.setOptions(options);
        client.sendReceiveNonBlocking(null, new MyCallbackHandler());
        Thread.sleep(10000);
    }

    static class MyCallbackHandler implements AxisCallback {
        public void onMessage(MessageContext messageContext) {
            System.out.println("On Message");

System.out.println(messageContext.getEnvelope().getBody().toString());
        }

        public void onFault(MessageContext messageContext) {
            System.out.println("On Fault");
        }

        public void onError(Exception e) {
            System.out.println("On Error");
        }

        public void onComplete() {
            System.out.println("On Message");
        }
    }

Thanks,
Keith.

[1] http://wso2.org/projects/mashup

On Mon, Sep 29, 2008 at 11:34 PM, Thiruvottiyur Subram, Nithya <
nithyas@qualcomm.com> wrote:

>  Hello,
>
>
>
> Thanks for your response. I am new to the whole web service concept, Could
> you please help me on how I can make it asynchronous?
>
>
>
> Thanks,
>
> Nithya
>
>
>  ------------------------------
>
> *From:* keith chapman [mailto:keithgchapman@gmail.com]
> *Sent:* Monday, September 29, 2008 11:02 AM
> *To:* axis-dev@ws.apache.org
> *Subject:* Re: Client times out before getting back the response
>
>
>
> Did you try calling the service in a async manner? If the server takes
> 15-10 mins to respond you might be better off doing this.
>
> Thanks,
> Keith.
>
> On Mon, Sep 29, 2008 at 11:18 PM, Thiruvottiyur Subram, Nithya <
> nithyas@qualcomm.com> wrote:
>
> Hello,
>
>
>
>
> We are having problems with our Client when the Server (running as a Web
> Service) takes a long time to process the request.
> The Client just times out after about 2 minutes in such cases. I tried
> setting the options for axis client in many ways:
>
> *options.setProperty(HTTPConstants.SO_TIMEOUT,  new Integer(1800000));
> options.setProperty(HTTPConstants.CONNECTION_TIMEOUT,  new
> Integer(1800000));*
> *options.setProperty(org.apache.axis2.transport.http.HTTPConstants.CONNECTION_TIMEOUT
> , new Integer("7200000"));*
> *Options.setTimeOutInMillis(100000000);*
> * *
> I modified axis2.xml too for timeout in case the server was the one
> initiating the closure.
>
> Nothing seems to work..
>
> Below is the error message on the client side. On the server side, there
> are no errors and we can see some processing going on (which will take
> about 15-20 mins)…
>
> *Sep 23, 2008 1:34:45 PM org.apache.axis2.transport.http.HTTPSender
> sendViaPost*
> *INFO: Unable to sendViaPost to url[**
> http://localhost:8084/WebServerTest/services/MediaFLOMDRQueryService*<http://localhost:8084/WebServerTest/services/MediaFLOMDRQueryService>
> *]*
> *java.net.SocketTimeoutException: Read timed out*
> *                at java.net.SocketInputStream.socketRead0(Native Method)*
> *                at java.net.SocketInputStream.read(Unknown Source)*
> *                at java.io.BufferedInputStream.fill(Unknown Source)*
> *                at java.io.BufferedInputStream.read(Unknown Source)*
> *                at
> org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77)*
> *                at
> org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105)*
> *                at
> org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1115)
> *
> *                at
> org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1373)
> *
> *                at
> org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1832)
> *
> *                at
> org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590)
> *
> *                at
> org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)
> *
> *                at
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
> *
> *                at
> org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
> *
> *                at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
> *
> *                at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
> *
> *                at
> org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:520)
> *
> *                at
> org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:191)
> *
> *                at
> org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77)*
> *                at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:327)
> *
> *                at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:206)
> *
> *                at
> org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396)*
> *                at
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:374)
> *
> *                at
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
> *
> *                at
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)*
> *                at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:528)*
> *                at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508)*
> *                at
> org.eclipse.cosmos.dc.provisional.cmdbf.query.client.QueryServiceClient.graphQuery(QueryServiceClient.java:97)
> *
> *                at
> org.eclipse.cosmos.dc.provisional.cmdbf.query.client.QueryServiceClient.graphQuery(QueryServiceClient.java:114)
> *
> *                at
> com.qualcomm.mediaflo.mdrclient.MdrClient.queryGraph(MdrClient.java:257)*
> *                at
> testMdR.testgetCompleteGraphForWebServices(testMdR.java:26)*
> *                at testMdR.main(testMdR.java:43)*
> *org.eclipse.cosmos.dc.provisional.cmdbf.exception.CMDBfException:
> org.apache.axis2.AxisFault: Read timed out*
> *                at
> org.eclipse.cosmos.dc.provisional.cmdbf.query.client.QueryServiceClient.graphQuery(QueryServiceClient.java:100)
> *
> *                at
> org.eclipse.cosmos.dc.provisional.cmdbf.query.client.QueryServiceClient.graphQuery(QueryServiceClient.java:114)
> *
> *                at
> com.qualcomm.mediaflo.mdrclient.MdrClient.queryGraph(MdrClient.java:257)*
> *                at
> testMdR.testgetCompleteGraphForWebServices(testMdR.java:26)*
> *                at testMdR.main(testMdR.java:43)*
> *Caused by: org.apache.axis2.AxisFault: Read timed out*
> *                at
> org.apache.axis2.AxisFault.makeFault(AxisFault.java:417)*
> *                at
> org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:195)
> *
> *                at
> org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77)*
> *                at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:327)
> *
> *                at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:206)
> *
> *                at
> org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396)*
> *                at
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:374)
> *
> *                at
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
> *
> *                at
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)*
> *                at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:528)*
> *                at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508)*
> *                at
> org.eclipse.cosmos.dc.provisional.cmdbf.query.client.QueryServiceClient.graphQuery(QueryServiceClient.java:97)
> *
> *                ... 4 more*
> *Caused by: java.net.SocketTimeoutException: Read timed out*
> *                at java.net.SocketInputStream.socketRead0(Native Method)*
> *                at java.net.SocketInputStream.read(Unknown Source)*
> *                at java.io.BufferedInputStream.fill(Unknown Source)*
> *                at java.io.BufferedInputStream.read(Unknown Source)*
> *                at
> org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77)*
> *                at
> org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105)*
> *                at
> org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1115)
> *
> *                at
> org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1373)
> *
> *                at
> org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1832)
> *
> *                at
> org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590)
> *
> *                at
> org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)
> *
> *                at
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
> *
> *                at
> org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
> *
> *                at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
> *
> *                at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
> *
> *                at
> org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:520)
> *
> *                at
> org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:191)
> *
> *                ... 14 more*
> *=======Query response:===*
> *<?xml version="1.0" encoding="UTF-8"?>*
> *INFO : QueryResponseHandler.buildGraph : Responce XML = <?xml
> version="1.0" encoding="UTF-8"?>*
> *INFO :
> com.qualcomm.mediaflo.mdrcommon.utils.XPathEvaluationHelper.constructor :
> Entered*
> *[Fatal Error] :1:39: Premature end of file.*
> *ERROR :
> com.qualcomm.mediaflo.mdrcommon.utils.XPathEvaluationHelper.constructor :
> Error while parsing the document Premature end of file.*
> *ERROR : QueryResponseHandler.buildGraph : Exception while buildGraph =
> null*
> *Exception in thread "main" java.lang.Exception:
> com.qualcomm.mediaflo.mdrcommon.exceptions.MfConfigurationException*
> *                at
> com.qualcomm.mediaflo.cosmos.QueryResponseHandler.buildGraph(QueryResponseHandler.java:130)
> *
> *                at
> com.qualcomm.mediaflo.mdrclient.MdrClient.queryGraph(MdrClient.java:283)*
> *                at
> testMdR.testgetCompleteGraphForWebServices(testMdR.java:26)*
> *                at testMdR.main(testMdR.java:43)*
> *Caused by:
> com.qualcomm.mediaflo.mdrcommon.exceptions.MfConfigurationException*
> *                at
> com.qualcomm.mediaflo.mdrcommon.utils.XPathEvaluationHelper.<init>(XPathEvaluationHelper.java:128)
> *
> *                at
> com.qualcomm.mediaflo.cosmos.QueryResponseHandler.buildGraph(QueryResponseHandler.java:83)
> *
> *                ... 3 more*
> *Caused by: org.xml.sax.SAXParseException: Premature end of file.*
> *                at
> com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
> *
> *                at
> com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown
> Source)*
> *                at javax.xml.parsers.DocumentBuilder.parse(Unknown
> Source)*
> *                at
> com.qualcomm.mediaflo.mdrcommon.utils.XPathEvaluationHelper.<init>(XPathEvaluationHelper.java:116)
> *
> *                ... 4 more*
> * *
> * *
> Thanks a lot,
> Nithya
>
>
>
>
> --
> Keith Chapman
> Senior Software Engineer
> WSO2 Inc.
> Oxygenating the Web Service Platform.
> http://wso2.org/
>
> blog: http://www.keith-chapman.org
>



-- 
Keith Chapman
Senior Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/

blog: http://www.keith-chapman.org

Mime
View raw message