KSOAP never timeout

纵饮孤独 提交于 2019-11-28 10:32:45

Use ksoap2 API version 2.5.2 or greater.

You can download that by clicking here

And use the following code while making object of HTTPTransport.

/**
 * Creates instance of HttpTransportSE with set url
 *
 * @param url
 *            the destination to POST SOAP data
 */
public HttpTransportSE(String url) {
    super(url);
}

/**
 * Creates instance of HttpTransportSE with set url
 *
 * @param url
 *            the destination to POST SOAP data
 * @param timeout
 *            timeout for connection and Read Timeouts (milliseconds)
 */
public HttpTransportSE(String url, int timeout) {
    super(url, timeout);
}

Have you downloaded the source and then compiled it? Or did you use a finished JAR file? Will test this tonight or early in the morning tomorrow.

I'm having the same problem running ksoap2-android-assembly-2.5.6-jar-with-dependencies. I would have assumed the ksoap timeout value that appears on HttpTransportSE would be equivalent to what you can accomplish using org.apache.http.client.HttpClient with connection timeout and socket timeout pamameters:

HttpClient client = new DefaultHttpClient(); HttpParams params = client.getParams(); HttpConnectionParams.setConnectionTimeout(params, CONNECTION_TIMEOUT); HttpConnectionParams.setSoTimeout(params, SOCKET_TIMEOUT);

I finally get a SocketException "the operation timed out" after ~3 minutes no matter what value I put in the timout parameter on HttpTransportSE. My server is running, its just not responding to the request.

This still seems to be an open issue with HttpTransportSE ignoring the timeout value in some situations. See related:

http://code.google.com/p/ksoap2-android/issues/detail?id=52

http://code.google.com/p/ksoap2-android/issues/detail?id=60&q=httpTransportse%20timeout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!