在android中调用Sap Web服务时出现XmlpullParserException

时间:2012-08-20 06:55:08

标签: android web-services sap

我收到如下所示的错误。请告诉我哪里出错了。

这是我写的代码

          SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
               SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                 SoapEnvelope.VER12);
               envelope.setOutputSoapObject(request);
               try {

                       HttpTransportSE  httpTransport = new HttpTransportSE(URL);
                       httpTransport.call(SOAP_ACTION, envelope);
              // httpTransport.call(SOAP_ACTION, envelope);
               SoapObject result = (SoapObject) envelope.bodyIn;
                    Log.i("Result........................", result.toString());
                    System.out.println(result);
                    Toast.makeText(SAPSoapWebservicesActivity.this, result.toString(),
                                50000).show();

             } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
             } catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
             }

08-20 12:01:01.606: WARN/System.err(939): org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <html>@1:6 in java.io.InputStreamReader@4052df28)

1 个答案:

答案 0 :(得分:1)

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

XML Parsing Error。如果未从服务器收到预先要求格式化的响应,则在解析时,解析器会推送此异常。

建议:

  • 在服务器的Parsing the response之前,只需通过在LogCat上烘烤或打印来跟踪它。
  • 检查您要传递给Parameters的{​​{1}}。如果需要Web Service Method,它会给您一个不合适的响应,而解析时会给出此异常因为Parser期待parameter or the method name does not match