2011-04-26 102 views
2

在我的应用程序中,我正在访问位于本地系统中的一些Web服务。当我从我的PC调用这些服务时,这些全部工作正常,但是当这些服务从另一个系统调用时。在电话会议上我收到错误“org.xmlpull.v1.XmlPullParserException:expected:START_TAG”错误

“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检查。但问题每次都是一样的。

请建议。谢谢。

回答

0

也许你在其他系统上没有得到XML响应。你可以看到你在说什么这样:

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

另外:不是,这可能是问题,但AndroidHttpTransport已过时,你应该使用HttpTransportSE

+0

好的,谢谢检查这种方式。 – Neteesh 2011-04-26 14:04:15

0

AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL);

我也有类似的问题,那是因为我不小心插入My命名空间地址,而不是URL,这是不同的。当我将它切换回来时,它就起作用了。

作为一个额外的建议,如果你没有看到你的参数得到正确传递,尽量排除该行:

soapEnvelope.dotNet = TRUE;

对我来说,我已经陷入不断为假,直到我评论说,线路输出传递一个布尔值。

相关问题