天气预报地址:http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl
package cn.com.WebXml;
/**
* @author: (le.qiao)
* @e-mail: qiaolevip@gmail.com
* @myblog: <a href="http://qiaolevip.iteye.com">http://qiaolevip.iteye.com</a>
* @date: 2014-8-1
*
*/
public class Test {
public static void main(String[] args) {
WeatherWebService webService = new WeatherWebServiceLocator();
try {
WeatherWebServiceSoap soapService = webService.getWeatherWebServiceSoap();
String[] response = soapService.getSupportProvince();
for (String province : response) {
System.out.println(province);
}
response = soapService.getSupportCity("上海");
for (String city : response) {
System.out.println(city);
}
response = soapService.getWeatherbyCityName("上海");
for (String city : response) {
System.out.println(city);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
本文介绍了如何通过WebXml API获取天气预报数据,包括获取支持的省份、城市和具体城市的天气信息。
708

被折叠的 条评论
为什么被折叠?



