问题
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