“org.xmlpull.v1.XmlPullParserException:预期:START_TAG”错误

发布于 2024-11-03 13:20:45 字数 1248 浏览 5 评论 0 原文

在我的应用程序中,我正在访问本地系统中的一些 Web 服务。当我从我的电脑调用这些服务时,这些服务都工作得很好,但是当这些服务从另一个系统调用时。在通话中我收到错误

“org.xmlpull.v1.XmlPullParserException: 预期:START_TAG”。

这是我的代码:

    public String getAccountsNames(int billId){

        String value = new String();
        System.out.println("Inside getAccountsDetails method...........");
        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
        request.addProperty("billId", billId);

        SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        soapEnvelope.dotNet=true;
        soapEnvelope.setOutputSoapObject(request);
        AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL);
        try
        {
            androidHttpTransport.call(SOAP_ACTION, soapEnvelope);
            SoapPrimitive  resultString = (SoapPrimitive)soapEnvelope.getResponse();
            value = resultString.toString();
            System.out.println("This getAccountsNames xmls is : "+xml);
        }   catch (Exception e) {
            e.printStackTrace ();
        }
        return value;
   }

我还通过设置 SoapEnvelope.VER11、VER12、VER10 进行了检查。但问题每次都是一样的。

请提出建议。谢谢。

In my application i am accessing some web services that are in my local system. When i am invoking this services from my PC, these all working abs fine but when these services called from another system. on the call i am receiving the error

"org.xmlpull.v1.XmlPullParserException:
expected: START_TAG".

Here is my code:

    public String getAccountsNames(int billId){

        String value = new String();
        System.out.println("Inside getAccountsDetails method...........");
        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
        request.addProperty("billId", billId);

        SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        soapEnvelope.dotNet=true;
        soapEnvelope.setOutputSoapObject(request);
        AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL);
        try
        {
            androidHttpTransport.call(SOAP_ACTION, soapEnvelope);
            SoapPrimitive  resultString = (SoapPrimitive)soapEnvelope.getResponse();
            value = resultString.toString();
            System.out.println("This getAccountsNames xmls is : "+xml);
        }   catch (Exception e) {
            e.printStackTrace ();
        }
        return value;
   }

Also i have checked by setting SoapEnvelope.VER11, VER12, VER10. But the problem is same everytime.

Please suggest. thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

℡寂寞咖啡 2024-11-10 13:20:45

当您使用其他系统时,您可能不会收到 XML 响应。您可以通过这种方式查看您得到的结果:

androidHttpTransport.debug = true;
// ...
// execute the request
// ...
androidHttpTransport.responseDump; // <-- a string containing server response

另外:这可能不是问题,但 AndroidHttpTransport 已被弃用,您应该使用 HttpTransportSE

Probably you're not getting an XML response when you're on other systems. You can see what you're getting this way:

androidHttpTransport.debug = true;
// ...
// execute the request
// ...
androidHttpTransport.responseDump; // <-- a string containing server response

Also: not that this might be the problem, but AndroidHttpTransport is deprecated, you should use HttpTransportSE.

我的鱼塘能养鲲 2024-11-10 13:20:45

AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL);

我遇到了类似的问题,这是因为我不小心插入了我的 NAMESPACE 地址而不是 URL,这是不同的。当我把它切换回来时,它起作用了。

作为补充建议,如果您没有看到参数正确传递,请尝试排除该行:

soapEnvelope.dotNet=true;

对我来说,我有一个布尔值,它不断地被作为 false 传递,直到我注释掉该行。

AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL);

I had a similar issue and it was because I accidently inserted my NAMESPACE address instead of the URL, which was different. When I switched that back out, it worked.

As an added suggestion, if you are not seeing your parameter getting passed correctly, try excluding the line:

soapEnvelope.dotNet=true;

for me, I had a boolean value that was constantly being passed as false until I commented that line out.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文