我想通过使用下面的代码调用webservice来获取城市列表

时间:2016-03-20 20:17:47

标签: java android asp.net web-services ksoap2

这是我得到的例外

  

org.xmlpull.v1.XmlPullParserException:意外的令牌(位置:TEXT [{“Id”:“57”,“Tit ... @ 1:275 in java.io.InputStreamReader@b629f48”)

使用以下代码

public String SuggestCity  (String CityName)  {
    SoapObject soapObject=new       SoapObject(Wsdl_Target_NameSpace,Operation_Name);
    PropertyInfo propertyInfo=new PropertyInfo();
    propertyInfo.setName("tryValue");
    propertyInfo.setValue(CityName);
    propertyInfo.setType(String.class);
    soapObject.addProperty(propertyInfo);
    SoapSerializationEnvelope serializationEnvelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);
    serializationEnvelope.setOutputSoapObject(soapObject);
    serializationEnvelope.dotNet=true;
    String response=null;
    HttpTransportSE androidHttpTransport = new HttpTransportSE(Soap_Adrress);
   //androidHttpTransport.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
    androidHttpTransport.debug=true;


    try{
        androidHttpTransport.call(Soap_Action, serializationEnvelope);
        SoapPrimitive result = (SoapPrimitive) serializationEnvelope.getResponse();
        response=result.toString();
        Log.d("asdf",result.toString());
        //response=androidHttpTransport.responseDump;
    }
   catch (Exception e){
        Log.d("Haha",e.toString());
    }
    return response;

}

任何想法?

0 个答案:

没有答案