“org.xmlpull.v1.XmlPullParserException:预期:START_TAG”错误
在我的应用程序中,我正在访问本地系统中的一些 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 进行了检查。但问题每次都是一样的。
请提出建议。谢谢。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您使用其他系统时,您可能不会收到 XML 响应。您可以通过这种方式查看您得到的结果:
另外:这可能不是问题,但
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:
Also: not that this might be the problem, but
AndroidHttpTransport
is deprecated, you should useHttpTransportSE
.我遇到了类似的问题,这是因为我不小心插入了我的 NAMESPACE 地址而不是 URL,这是不同的。当我把它切换回来时,它起作用了。
作为补充建议,如果您没有看到参数正确传递,请尝试排除该行:
对我来说,我有一个布尔值,它不断地被作为 false 传递,直到我注释掉该行。
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:
for me, I had a boolean value that was constantly being passed as false until I commented that line out.