解釋下面代碼:
<wsdl:service name="WeatherWS">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"><a href="http://www.webxml.com.cn/" target="_blank">WebXml.com.cn</a> <strong>2400多個城市天氣預報Web服務</strong>,包含2300個以上中國城市和100個以上國外城市天氣預報數據。數據每2.5小時左右自動更新一次,准確可靠。<br />使用本站 WEB 服務請注明或鏈接本站:<a href="http://www.webxml.com.cn/" target="_blank">http://www.webxml.com.cn/</a> 感謝大家的支持!<br /><br /><img alt="PDF" title="PDF file" src="http://www.webxml.com.cn/images/icon/pdf.gif" style="vertical-align: middle;" /> <a href="http://www.webxml.com.cn/files/WeatherWsHelp.pdf" target="_blank">接口幫助文檔</a> &nbsp;&nbsp;&nbsp; <img alt="ZIP" title="ZIP file" src="http://www.webxml.com.cn/images/icon/zip.gif" style="vertical-align: middle;" /> <a href="http://www.webxml.com.cn/files/about_city.zip">部分城市介紹和氣候背景</a> &nbsp;&nbsp;&nbsp; <img alt="ZIP" title="ZIP file" src="http://www.webxml.com.cn/images/icon/zip.gif" style="vertical-align: middle;" /> <a href="http://www.webxml.com.cn/files/city_photo.zip">部分城市圖片</a> &nbsp;&nbsp;&nbsp; <img alt="HTML" title="HTML file" src="http://www.webxml.com.cn/images/icon/html.gif" style="vertical-align: middle;" /> <a href="http://www.webxml.com.cn/zh_cn/weather_icon.aspx" target="_blank">天氣現象和圖例</a><br />&nbsp;</wsdl:documentation>
<wsdl:port name="WeatherWSSoap" binding="tns:WeatherWSSoap">
<soap:address location="http://ws.webxml.com.cn/WebServices/WeatherWS.asmx" />
</wsdl:port>
<wsdl:port name="WeatherWSSoap12" binding="tns:WeatherWSSoap12">
<soap12:address location="http://ws.webxml.com.cn/WebServices/WeatherWS.asmx" />
</wsdl:port>
<wsdl:port name="WeatherWSHttpGet" binding="tns:WeatherWSHttpGet">
<http:address location="http://ws.webxml.com.cn/WebServices/WeatherWS.asmx" />
</wsdl:port>
<wsdl:port name="WeatherWSHttpPost" binding="tns:WeatherWSHttpPost">
<http:address location="http://ws.webxml.com.cn/WebServices/WeatherWS.asmx" />
</wsdl:port>
</wsdl:service>
1、<wsdl:service name="WeatherWS"> 這個WeatherWS其實就是服務器端的service接口,這樣的話在客戶端就要通過這個new 一個接口工廠出來
現在可以寫一個測試類
//new 對象生產SEI對象的
WeatherWS weatherWS = new WeatherWS();
//使用工廠調用出代理對象 WeatherWSSoap也是一個接口,這個時候就可以調用方法
WeatherWSSoap weatherWSSoap = weatherWS.getWeatherWSSoap();
//分裝的list集合(String類型)
ArrayOfString weather = weatherWSSoap.getWeather("新沂", null);
List<String> list = weather.getString();
System.out.println(list);
此時結果顯示在控制台