[Android]:在android中访问soap web服务时kmlparser异常

发布于 2024-10-08 01:59:26 字数 1376 浏览 5 评论 0原文

我正在使用下面的代码来访问肥皂网络服务。但我遇到了异常。请帮忙。

例外:

    org.xmlpull.v1.XmlPullParserException: expected: 
START_TAG {http://schedmas.xmlsoap.org/soap/envelope/}
Envelop (position:START_TAG<definitions targetNamespace='urn:schedule'>@2:425 in java.io.InputStreamreader@43d36520)

代码:

public SoapObject soap(String METHOD_NAME, String SOAP_ACTION, String NAMESPACE, String URL) throws IOException, XmlPullParserException {

         SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); //set up request
         request.addProperty("access_key", "5rrtrtr");
         request.addProperty("type", "facebook");
         request.addProperty("access_secrete", "5rtrt");
         request.addProperty("message", "5");
         request.addProperty("date", "2010/12/16");
         request.addProperty("time", "05:10:00");
         request.addProperty("ampm", "AM");
         SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
        envelope.setOutputSoapObject(request);  //prepare request
         HttpTransportSE httpTransport = new HttpTransportSE(URL);  
         httpTransport.debug = true;  
         httpTransport.call(SOAP_ACTION, envelope); //send request
         SoapObject result=(SoapObject)envelope.getResponse(); //get response
         return result;
      }

I am using below code to access soap web service. But I am getting exception .Please help.

Exception :

    org.xmlpull.v1.XmlPullParserException: expected: 
START_TAG {http://schedmas.xmlsoap.org/soap/envelope/}
Envelop (position:START_TAG<definitions targetNamespace='urn:schedule'>@2:425 in java.io.InputStreamreader@43d36520)

Code:

public SoapObject soap(String METHOD_NAME, String SOAP_ACTION, String NAMESPACE, String URL) throws IOException, XmlPullParserException {

         SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); //set up request
         request.addProperty("access_key", "5rrtrtr");
         request.addProperty("type", "facebook");
         request.addProperty("access_secrete", "5rtrt");
         request.addProperty("message", "5");
         request.addProperty("date", "2010/12/16");
         request.addProperty("time", "05:10:00");
         request.addProperty("ampm", "AM");
         SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
        envelope.setOutputSoapObject(request);  //prepare request
         HttpTransportSE httpTransport = new HttpTransportSE(URL);  
         httpTransport.debug = true;  
         httpTransport.call(SOAP_ACTION, envelope); //send request
         SoapObject result=(SoapObject)envelope.getResponse(); //get response
         return result;
      }

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

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

发布评论

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

评论(1

殊姿 2024-10-15 01:59:26

我不确定,但就我而言,我检查了 url &命名空间。我遇到了同样的错误。请先尝试一下。

I am not sure but in my case I checked out the url & namespace.I am got the same error.Please try out that first.

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