【问题标题】:BufferedInputStream is closedBufferedInputStream 已关闭
【发布时间】:2017-10-15 09:48:14
【问题描述】:

我正在开发一个在登录页面中包含忘记密码概念的安卓应用程序。我正在为此应用程序使用 Soap Web 服务。

这是我的代码:

public void fncCallForgotPasswordService() {
        String SOAP_ACTION = "http://example.org/ForgotPWD";
        String METHOD_NAME = "ForgotPWD";;
        String NAMESPACE = "http://example.org/";
        String URL = "https://in.xyz.com/abcd.example/MethodExample.asmx";

        try {
            SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
            Request.addProperty("UID", strUserID);
            Request.addProperty("CID", strCompID);

            SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            soapEnvelope.dotNet = true;
            soapEnvelope.setOutputSoapObject(Request);

            HttpTransportSE transport = new HttpTransportSE(URL);
            transport.call(SOAP_ACTION, soapEnvelope);
            resultString = (SoapObject) soapEnvelope.getResponse();
            resultString = (SoapObject) resultString.getProperty("Data");
            resultString = (SoapObject) resultString.getProperty("Row");
            strMessage = resultString.getPropertyAsString("Message");

            if (resultString != null) {
                Log.i("Message", strMessage);
            }

            Log.i("Result", "Result Celsius: " + resultString);
        } catch (Exception ex) {
            Log.e("Error", "Error: " + ex.getMessage());
        }
    }

Web 服务正在提供新密码,但问题是我收到一个异常提示

org.xmlpull.v1.XmlPullParserException: Invalid stream or encoding: java.io.IOException: BufferedInputStream is closed (position:START_DOCUMENT null@1:1) caused by: java.io.IOException: BufferedInputStream is closed

SoapObject 'resultString' 首次调用 Web 服务时显示 null,并显示上述异常。但是当我连续第二次或第三次尝试时,没有抛出异常。只有在第一次调用忘记密码web服务时,才会抛出上述异常。

此外,无论有无例外,我都会在手机上收到新密码。

但我担心为什么会发生此异常。

请帮忙!

提前致谢。

【问题讨论】:

    标签: android soap xml-parsing xmlpullparser


    【解决方案1】:

    尝试自定义非标准的超时值:

    HttpTransportSE androidHttpTransport = new HttpTransportSE(this.url,this.connectionTimeout)
    

    【讨论】:

    • 已经实现。但仍然没有成功,仍然报同样的错误。
    • 你尝试包装响应了吗??
    • 我可以看看你的 wsdl 文件吗??
    猜你喜欢
    • 1970-01-01
    • 2012-04-27
    • 2014-02-22
    • 2021-12-13
    • 2019-09-24
    • 1970-01-01
    • 1970-01-01
    • 2011-06-18
    • 2015-11-17
    相关资源
    最近更新 更多