Ksoap2 Android IllegalStateException

眉间皱痕 提交于 2019-12-11 05:20:07

问题


I am using Ksoap2 to consume my webservices, on some devices i am getting this exception, java.lang.IllegalStateException: Cannot set request property after connection is made.

I am trying to resolve it from two days but without any key to resolve it.

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)

And here is how i am using 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();

Any one can help with this?

Regards

来源:https://stackoverflow.com/questions/28979672/ksoap2-android-illegalstateexception

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