JAX-WS获取天气预报wsdl

天气预报地址: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();
		}
	}
}

 

你可能感兴趣的:(学习永无止境,每天进步一点点,wsdl,纵观千象)