码迷,mamicode.com
首页 > 编程语言 > 详细

使用ksoap2报java.io.EOFException异常问题解决方法

时间:2014-09-25 19:39:17      阅读:433      评论:0      收藏:0      [点我收藏+]

标签:android   style   blog   http   color   io   os   使用   java   

使用ksoap2调用WebService数据读取正常,但一直报异常:

java.io.EOFException
    at libcore.io.Streams.readAsciiLine(Streams.java:203)
    at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:560)
    at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:813)
    at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:274)
    at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:486)
    at org.ksoap2.transport.ServiceConnectionSE.getResponseCode(ServiceConnectionSE.java:103)
    at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:197)
    at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:118)
    at .utils.Webservices.callinternet(Webservices.java:125)
    at .utils.Webservices.getResponse(Webservices.java:73)
    at .utils.Webservices.getResponse(Webservices.java:79)
    at .utils.Webservices.getResponse(Webservices.java:79)
    at .utils.AsynTask.doInBackground(AsynTask.java:61)
    at .utils.AsynTask.doInBackground(AsynTask.java:1)
    at android.os.AsyncTask$2.call(AsyncTask.java:287)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
    at java.lang.Thread.run(Thread.java:856)

解决方法1
ArrayList<HeaderProperty> headerPropertyArrayList = new ArrayList<HeaderProperty>();
headerPropertyArrayList.add(new HeaderProperty("Connection", "close"));
httpSE.call(SOAP_ACTION, envelope, headerPropertyArrayList);

 加上红色部分代码就解决了。

 

解决方法2
使用 ksoap2-android-assembly-2.6.4-jar-with-dependencies.jar这个版本的ksoap2的包不会出现这样的问题。

使用ksoap2报java.io.EOFException异常问题解决方法

标签:android   style   blog   http   color   io   os   使用   java   

原文地址:http://www.cnblogs.com/jueding920/p/3993268.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!