該樓層疑似違規已被系統折疊 隐藏此樓檢視此樓
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異常