Call the free web service to get weather forecast information first find the weather forecast provides WebService network address: WSDL file description http://webservice.webxml.com.cn/WebServices/ Weatherws.asmx wsdl file http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl then save as webservice.wsdl modify file <s:element ref= "S:schema"/></any> for <s:any minoccurs= "2" maxoccurs= "2"/> Then build javaproject<p> in MyEclipse create WebClient client </p><p> then call 4 import java.util.List; 5 Import cn.com.webxml.ArrayOfString; 6 Import Cn.com.webxml.WeatherWS; 7 Import Cn.com.webxml.WeatherWSSoap; 8 9 public class Weatherwsclient {Ten public static void Main (string[] args) {12//Create a WEATHERWS factory 13 WEATHERWS factory = new Weatherws (); 14//Create a Weatherwssoap object according to the factory weatherwssoap Weatherwssoap = Factory . Getweatherwssoap (); 16//Call the GetWeather method provided by WebService to get the weather forecast for Zhengzhou. arrayofstring Weatherinfo = Weatherwsso Ap.getweather ("Zhengzhou", null); List<string> lstweatherinfo = weatherinfo.getstring (); 19//Traverse weather forecast Information 20 for (string string:lstweatherinfo) {System.out.println (string); System.out.println ("----- -------------------");}24}25}</p>
</pre><br/><br/>
WebService getting weather information