欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

JAX-WS获取天气预报wsdl

程序员文章站 2022-03-25 21:27:38
...

天气预报地址:http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl

 

package cn.com.WebXml;

/**
 * @author: (le.qiao)
 * @e-mail: [email protected]
 * @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();
		}
	}
}