我在Android应用中使用ksoap2-android-assembly-3.4.0-jar-with-dependencies.jar
代码工作正常但有时我在做很多请求时会收到此错误
04-30 16:25:12.212: W/System.err(3397): java.io.EOFException
04-30 16:25:12.212: W/System.err(3397): at libcore.io.Streams.readAsciiLine(Streams.java:203)
04-30 16:25:12.212: W/System.err(3397): at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:560)
04-30 16:25:12.212: W/System.err(3397): at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:813)
04-30 16:25:12.212: W/System.err(3397): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:274)
04-30 16:25:12.212: W/System.err(3397): at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:486)
04-30 16:25:12.212: W/System.err(3397): at org.ksoap2.transport.ServiceConnectionSE.getResponseCode(ServiceConnectionSE.java:103)
04-30 16:25:12.212: W/System.err(3397): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:192)
04-30 16:25:12.212: W/System.err(3397): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:118)
04-30 16:25:12.216: W/System.err(3397): at com.coffeeandcookies.edea.app.request(app.java:142)
04-30 16:25:12.216: W/System.err(3397): at tasks.registro.doInBackground(registro.java:43)
04-30 16:25:12.216: W/System.err(3397): at tasks.registro.doInBackground(registro.java:1)
04-30 16:25:12.216: W/System.err(3397): at android.os.AsyncTask$2.call(AsyncTask.java:287)
04-30 16:25:12.216: W/System.err(3397): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
04-30 16:25:12.216: W/System.err(3397): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
04-30 16:25:12.216: W/System.err(3397): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
04-30 16:25:12.216: W/System.err(3397): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
04-30 16:25:12.216: W/System.err(3397): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
04-30 16:25:12.216: W/System.err(3397): at java.lang.Thread.run(Thread.java:856)
public static String request(String metodo,String sucursal, String cuenta)
{
SoapObject request = new SoapObject(app.NAMESPACE, metodo);
request.addProperty(app.param_sucursal, sucursal);
request.addProperty(app.param_cuenta, cuenta);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(app.URL);
androidHttpTransport.debug = true;
List<HeaderProperty> headerList = new ArrayList<HeaderProperty>();
headerList.add(new HeaderProperty("Authorization", "Basic " + org.kobjects.base64.Base64.encode(app.user.getBytes())));
androidHttpTransport.call(app.SOAP_ACTION, envelope, headerList);
return androidHttpTransport.responseDump;
}
感谢您的帮助!
可能是图书馆的错误
https://code.google.com/p/ksoap2-android/issues/detail?id=199
https://code.google.com/p/ksoap2-android/issues/detail?id=207