webService學習7:呼叫天氣介面
阿新 • • 發佈:2019-02-18
1 參考
2 在wsdl中搜索 wsdl:service入口類
3 程式碼編寫
package test; import java.util.List; import cn.com.webxml.ArrayOfString; import cn.com.webxml.WeatherWebService; import cn.com.webxml.WeatherWebServiceSoap; public class WeatherTest { /** * @param args */ public static void main(String[] args) { WeatherWebService weatherWS = new WeatherWebService(); WeatherWebServiceSoap weatherSoap = weatherWS.getWeatherWebServiceSoap(); List weathInfo = weatherSoap.getWeatherbyCityName("廣州").getString(); for(int i =0 ; i < weathInfo.size() ; i++){ System.out.println(weathInfo.get(i)); } } }
4 結果顯示