我正在使用SOAP Web服务开发Android应用程序。当请求的响应过长时,它会在这行代码上抛出一个IOException异常:androidHttpTransport.call(SOAP_ACTION, envelope);
我的代码:
try {
SoapObject request = new SoapObject(Constants.NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.encodingStyle = "rpc";
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(Constants.WSDL);
androidHttpTransport.debug = true;
androidHttpTransport.call(SOAP_ACTION, envelope);
Object result = (Object)envelope.getResponse();
String results = result.toString();
Log.e(TAG, "Result = "+results);
return parseJson(results);
} catch (Exception e) {
Log.e(TAG, "Error with SOAP", e);
Log.e(TAG, e.getMessage());
return new ArrayList<Route>();
}
异常情况:
12-03 13:52:56.807: E/RoutesLoader(20272): Error with SOAP
12-03 13:52:56.807: E/RoutesLoader(20272): java.io.IOException: BufferedInputStream is closed
12-03 13:52:56.807: E/RoutesLoader(20272): at java.io.BufferedInputStream.streamClosed(BufferedInputStream.java:118)
12-03 13:52:56.807: E/RoutesLoader(20272): at java.io.BufferedInputStream.read(BufferedInputStream.java:279)
12-03 13:52:56.807: E/RoutesLoader(20272): at java.util.zip.GZIPInputStream.readFully(GZIPInputStream.java:204)
12-03 13:52:56.807: E/RoutesLoader(20272): at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:98)
12-03 13:52:56.807: E/RoutesLoader(20272): at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:81)
12-03 13:52:56.807: E/RoutesLoader(20272): at org.ksoap2.transport.HttpTransportSE.getUnZippedInputStream(HttpTransportSE.java:274)
12-03 13:52:56.807: E/RoutesLoader(20272): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:223)
12-03 13:52:56.807: E/RoutesLoader(20272): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:114)
12-03 13:52:56.807: E/RoutesLoader(20272): at eu.akting.bidekide.content.RoutesLoader.downloadRoutes(RoutesLoader.java:51)
12-03 13:52:56.807: E/RoutesLoader(20272): at eu.akting.bidekide.content.RoutesLoader.loadInBackground(RoutesLoader.java:36)
12-03 13:52:56.807: E/RoutesLoader(20272): at eu.akting.bidekide.content.RoutesLoader.loadInBackground(RoutesLoader.java:1)
12-03 13:52:56.807: E/RoutesLoader(20272): at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:240)
12-03 13:52:56.807: E/RoutesLoader(20272): at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:51)
12-03 13:52:56.807: E/RoutesLoader(20272): at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:40)
12-03 13:52:56.807: E/RoutesLoader(20272): at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:123)
12-03 13:52:56.807: E/RoutesLoader(20272): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
12-03 13:52:56.807: E/RoutesLoader(20272): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
12-03 13:52:56.807: E/RoutesLoader(20272): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
12-03 13:52:56.807: E/RoutesLoader(20272): at java.lang.Thread.run(Thread.java:856)
12-03 13:52:56.807: E/RoutesLoader(20272): BufferedInputStream is closed
有什么想法吗? 我在解压响应时遇到了问题,但我不知道如何修复。