-->

Ksoap2的Android IllegalStateException异常(Ksoap2 Andr

2019-10-22 05:46发布

我使用Ksoap2消耗我的web服务,在某些设备上我得到这个例外,java.lang.IllegalStateException:不能设置请求属性连接后。

我想从两个天,但没有任何键来解决它解决它。

java.lang.IllegalStateException: Cannot set request property after connection is made
at com.android.okhttp.internal.http.HttpURLConnectionImpl.setRequestProperty(HttpURLConnectionImpl.java:496)
at com.android.okhttp.internal.http.DelegatingHttpsURLConnection.setRequestProperty(DelegatingHttpsURLConnection.java:258)
at com.android.okhttp.internal.http.HttpsURLConnectionImpl.setRequestProperty(HttpsURLConnectionImpl.java:25)
at org.ksoap2.transport.ServiceConnectionSE.setRequestProperty(ServiceConnectionSE.java:101)
at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:156)
at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:116)
at mypkg.webservice.SoapRequest.getResponse(SoapRequest.java:66)
at mypkg.webservice.SoapObjectService.call(SoapObjectService.java:45)
at mypkg.webservice.ServiceCall.call(ServiceCall.java:29)
at mypkg.loadContentFromService(ContentManager.java:207)
at mypkg.loadContentFromCache(ContentManager.java:177)
at mypkg.refreshContent(ContentManager.java:125)
at mypkg.refresh(MyClass.java:93)
at mypkg.syncAll(MyClass2.java:148)

而这里是我如何使用KSOAP,

   String soapAction = SERVICE_NAMESPACE + methodName;
    SoapObject request = new SoapObject(SERVICE_NAMESPACE, methodName);
    if (properties != null)
        for (PropertyInfo pro : properties) {
            request.addProperty(pro);
        }

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.dotNet = true;
    envelope.implicitTypes = true;
    envelope.setOutputSoapObject(request);
    HttpTransportSE androidHttpTransport = new HttpTransportSE(serviceURL, 30000);
    androidHttpTransport.debug = false;
    androidHttpTransport.call(soapAction, envelope);
return envelope.getResponse();

任何一个可以帮助呢?

问候

文章来源: Ksoap2 Android IllegalStateException