WebService simple tutorial

Obtaining information from the description

Code Example:

. 1  Import com.gyf.weather.ws.ArrayOfString;
 2  Import com.gyf.weather.ws.WeatherWS;
 . 3  Import com.gyf.weather.ws.WeatherWSSoap;
 . 4  
. 5  public  class the Main {
 . 6  
. 7      public  static  void main (String [] args) {
 . 8  
. 9          // looking up from the lower, first find the service specification WeatherWS
 10          // Get service 
. 11          WeatherWS WS = new new WeatherWS ();
 12 is          // Get port 
13 is          WeatherWSSoap SOAP = ws.getPort (WeatherWSSoap. class );
 14 
15          // 1. Access to foreign country names and the corresponding ID 
16  / *         ArrayOfString soap.getRegionCountry AOS = ();
 . 17          for (String Region: aos.getString ()) {
 18 is              System.out.println (Region);
 19          } * / 
20  
21          // 2. supported city / region name and the corresponding ID 
22          / * ArrayOfString the AOS = soap.getSupportCityString ( "Jilin");
 23          for (String city: aos.getString ()) {
 24              System.out.println (City);
 25          } * / 
26 is  
27          // 3. acquires weather information 
28         ArrayOfString aos = soap.getWeather("吉林", "");
29         for (String item : aos.getString()){
30             System.out.println(item);
31         }
32 
33     }
34 }

 

Guess you like

Origin www.cnblogs.com/116970u/p/11100324.html