该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
public static SoapObject getWeateherByCity(String cityName){
String methodName="getWeather";
HttpTransportSE ht = new HttpTransportSE(SERVICE_URL);
ht.debug = true;
SoapSerializationEnvelope envelop = new SoapSerializationEnvelope(SoapEnvelope.VER11);
SoapObject soapobject = new SoapObject(SERVICE_NS, methodName);
soapobject.addProperty("theCityCode",cityName);
envelop.bodyOut = soapobject;
envelop.dotNet = true;
try {
ht.call(SERVICE_NS+methodName, envelop); //程序到这里会出现异常
SoapObject result = (SoapObject) envelop.bodyIn;
SoapObject detail = (SoapObject) result.getProperty(methodName+"Result");
ArrayList lis = (ArrayList) parseProvinceOrCity(detail);
for(int i = 0;i
System.out.println(lis.get(i));
}
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("异常1");
e.printStackTrace();
} catch (XmlPullParserException e) {
// TODO Auto-generated catch block
System.out.println("异常");
e.printStackTrace();
}
return null;
}
//提示SERVICE_NS+methodName = http://WebXml.com.cn/getWeather
当程序到ht.call(SERVICE_NS+methodName, envelop); 这里时。。会出现XmlPullParserException异常