本资源引用于http://download.csdn.net/source/1156344
我做了下改动,大家分享一下。
webService服务地址:
http://www.webxml.com.cn/WebServices/WeatherWebService.asmx
private static String getSoapRequest1(String city) {
try {
InputStreamReader isr = new InputStreamReader(new FileInputStream(
"WebRoot/weather.xml"));
BufferedReader reader = new BufferedReader(isr);
StringBuffer soap = new StringBuffer("");
String tmp;
while ((tmp = reader.readLine()) != null) {
soap =soap.append(tmp);
}
reader.close();
isr.close();
return soap.toString().replace("${city}$", city);
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
}
1