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


    使用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的包不会出现这样的问题。
  • 相关阅读:
    [原创]什么是兼容性测试?
    [原创]Web开发测试辅助工具介绍
    [原创]如何顺利通过中国电信Brew平台软件测试?
    [原创]网站性能优化利器之二"Yahoo Yslow"
    [原创]HP SiteScope工具介绍及下载地址
    [原创]网站前端页面级性能测试方法
    [原创]网银在线chinabank安全漏洞之“不完善的开发软件包”
    [原创] linux必学的常用命令
    [原创]如何做好目标管理?
    Visual Studio 小技巧:自定义代码片断
  • 原文地址:https://www.cnblogs.com/jueding920/p/3993268.html
Copyright © 2020-2023  润新知