本文介绍了Android的KSOAP连接超时使用同一个无线网络上的多个设备时:(的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好大家谁花时间阅读,并希望能尽量帮助解决这个问题。

总之,我的应用程序现在工作超过一年以上。我有100000+下载,以及最近才与我的SOAP Web服务的问题开始出现。如果两个或更多的设备连接到同一无线连接只有一个设备工作正常。在所有其他设备连接会超时。
下面是WS调用方法示例:

 公共静态对象callWSMethod(字符串methodName中,字符串的soapAction,
        的PropertyInfo []属性)抛出IOException异常,
        XmlPullParserException {    SoapObject要求=新SoapObject空间(namespace,方法名);
    如果(属性!= NULL)
        对于(的PropertyInfo财产:属性){
            request.addProperty(财产);
        }    SoapSerializationEnvelope信封=新SoapSerializationEnvelope(
            SoapEnvelope.VER11);
    envelope.setOutputSoapObject(请求);
    envelope.implicitTypes = TRUE;    HttpTransportSE httpTransport =新HttpTransportSE(SOAP_ADDRESS,15000);
    httpTransport.debug = TRUE;
    httpTransport.call(的soapAction,信封);    返回envelope.getResponse();
}

任何建议或想法将是非常有益的。先谢谢了。


解决方案

 我已经设置了超时时间以毫秒为单位像下面同时呼吁web服务
HttpTransportSE androidHttpTransport =新HttpTransportSE(URL,6000);(注 - 确保您使用的是最新的ksoap2库,如果你想下载的ksoap2以下链接的后续下载最新版本。)http://ksoap2-android.google$c$c.com/svn/m2-repo/com/google/$c$c/ksoap2-android/ksoap2-android-assembly/3.0.0-RC.4/并点击ksoap2-机器人组装-3.0.0-RC.4.jar

Hello to all of you who took the time to read this and, hopefully, try help with this problem.

In short, my application works for longer than year now. I have 100000+ downloads, and only recently the problems with my soap web services started to occur. If two or more devices are connected to the same wireless connection only one device is working properly. On all the other devices connection gets timed out.Here is sample of WS call method:

public static Object callWSMethod(String methodName, String soapAction,
        PropertyInfo[] properties) throws IOException,
        XmlPullParserException{

    SoapObject request = new SoapObject(NAMESPACE, methodName);
    if (properties != null)
        for (PropertyInfo property : properties) {
            request.addProperty(property);
        }

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
            SoapEnvelope.VER11);
    envelope.setOutputSoapObject(request);
    envelope.implicitTypes = true;

    HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS, 15000);       
    httpTransport.debug = true;             
    httpTransport.call(soapAction, envelope);

    return envelope.getResponse();
}

Any suggestions or ideas would be very helpful. Thanks in advance.

解决方案
I have set the timeout in milliseconds like below while calling webservice
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL,6000);

(Note - make sure you are using latest ksoap2 library. if you want to download newest version of ksoap2 the follow below link to download)

http://ksoap2-android.googlecode.com/svn/m2-repo/com/google/code/ksoap2-android/ksoap2-android-assembly/3.0.0-RC.4/

and click on ksoap2-android-assembly-3.0.0-RC.4.jar 

这篇关于Android的KSOAP连接超时使用同一个无线网络上的多个设备时:(的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 19:35