中国气象局的wsdl:http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl
使用Eclipse 新建一个JAVA项目client 然后 在Eclipse中点击File>new>Other>webServer > web Server Client>next>Service definition 中输入http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl
>next>选择输入位置 client/src>finish
然后新建一个Client类 代码如下:
public class Client {
public static void main(String[] args) {
WeatherWebServiceSoap wwss = new WeatherWebServiceSoapProxy();
try {
/**
*
*根据城市或地区名称查询获得未来三天内天气情况、现在的天气实况、天气和生活指数
*/
String[] str = wwss.getWeatherbyCityName("西安");
for(int i =0;i<str.length;i++){
System.out.println(str[i]);
}
} catch (RemoteException e) {
e.printStackTrace();
}
}
}