Android HttpTransportSE套接字超时异常并且耗时太长

时间:2017-07-10 09:30:12

标签: android sockets android-ksoap2

我需要使用HttpTransportSE调用soap web服务,我使用以下方法:

 HttpTransportSE httpTransport = new HttpTransportSE(URL,40000);
    httpTransport.debug = true;

    try {
        httpTransport.call(SOAP_ACTION, envelope);
    } catch (Exception e) {
        Log.d("Eee", e + "");
    }
    //    result = (String) envelope.getResponse();
    String isFaulted="true";
    try {
        SoapObject res = (SoapObject) envelope.bodyIn;
        SoapObject t = (SoapObject) res.getProperty("MethodResult");
        result = t.getProperty("Result").toString();
        isFaulted =t.getProperty("IsFaulted").toString();

    } catch (Exception e) {
        SoapFault res = (SoapFault) envelope.bodyIn;
        Log.d("Eee", res.getMessage());
    }

当我在没有40000的情况下调用此方法new HttpTransportSE(URL,40000)时,它返回sockettimeoutexception,否则在用40000秒调用它时需要大约1分钟才能返回真实结果

如何在没有套接字超时异常的情况下减少时间的任何帮助?

0 个答案:

没有答案