简体   繁体   中英

HttpTransportSe.call() method taking up to a minute for web service call

I am calling a web service from my Android application. I have many different calls to this service all through the application and every one of them is returning data in less than a second, except for one. One of my calls can take up to a minute to return the data even though the actual web service call is near instantaneous. The problem occurs with the line:

transport.call(SOAP_ACTION, soapEnvelope);

That is called and the value is returned from the web service almost instantaneously. But it can take up to a minute to reach the next line:

SoapObject result = (SoapObject) soapEnvelope.bodyIn;

What is happening between the web service returning data and the app hitting the next line (above)? Is there a way to reduce this delay? Is there anything simple to check?

Is there a way to reduce this delay? Is there anything simple to check?

The only way to know is to measure the difference in time in various areas. For a SOAP web service call these are the times to measure.

Client side time

Client Application code -> Request Handlers -> Request Serialization -> Request dispatch -> HTTP Transport -> Server side

Server side time

Receive HTTP Request -> De-serialization -> Application code -> Response handlers -> Serialization -> Dispatch -> HTTP Transport

The blockage is usually in the application code, handlers and the network. Measure those and you can find where the time is spent.

  • To measure CPU time taken by your application code and handlers use a profiler. I'd recommend Jprofiler .
  • To measure network time, ping the target server and also use a web debugging proxy like Charles . It can tell you the time spent by the request on the network.

Turns out the delay was only while debugging the app. When running the app without the debugger attached it returns near instanteously.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM