-->

的Android KSOAP连接超时使用同一无线网络中多台设备时:((Android ksoap c

2019-10-18 08:26发布

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

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();
}

任何建议或想法将是有益的。

Answer 1:

原来ksoap2效果很好,和我的代码工作得很好。 跟踪KSOAP调用方法,和嗅探HTML流量后,我发现,有时候,服务器不会对我的请求作出回应。 这是因为服务器的配置被改变,而现在,当有很多来自同一IP地址的请求,服务器会将其中一些为重传和忽略它们。 这个问题对服务器端解决。



Answer 2:

我已经设置了超时以毫秒为单位像下面同时呼吁web服务

HttpTransportSE androidHttpTransport = new HttpTransportSE(URL,6000);

(注 - 请确保您使用的是最新的ksoap2库,如果你想下载的ksoap2以下链接的后续下载最新版本。)

https://oss.sonatype.org/content/repositories/ksoap2-android-releases//com/google/code/ksoap2-android/ksoap2-android-assembly/3.0.0-RC.4/

并点击ksoap2,机器人组装-3.0.0-RC.4.jar



文章来源: Android ksoap connection timed out when using more than one device on same wireless network :(