웹 서비스 일기예보 찾기

2244 단어 Webwebservice

->new->Axis2 wizards
->Axis2 Cord Generator
-> Generate java source code from WSDL file
->WSDL file local->  
http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl->
  custom package name     com.zyl.test
   http://WebXml.com.cn/   com.zyl.test
->output path         


package com.zyl.test;

import java.rmi.RemoteException;

public class TestWeather {

	public static void main(String[] args) throws RemoteException {
		WeatherWSStub weather = new WeatherWSStub();

		WeatherWSStub.GetRegionCountry region_country = new WeatherWSStub.GetRegionCountry();
		WeatherWSStub.ArrayOfString country = weather
				.getRegionCountry(region_country).localGetRegionCountryResult;
		String[] countries = country.localString;
		for (String string : countries) {

			System.out.println(string);
			String[] mycountry = string.split(",");
			System.out.println(mycountry[0] + ">>>>>>>" + mycountry[1]);
		}

		WeatherWSStub.GetRegionProvince region_province = new WeatherWSStub.GetRegionProvince();
		WeatherWSStub.ArrayOfString province = weather
				.getRegionProvince(region_province).localGetRegionProvinceResult;
		String[] provincies = province.localString;
		for (String string : provincies) {
			System.out.println(string);
		}

		WeatherWSStub.GetSupportCityString region_city = new WeatherWSStub.GetSupportCityString();
		region_city.setTheRegionCode("3114");
		String[] cities = weather.getSupportCityString(region_city).localGetSupportCityStringResult.localString;
		for (String string : cities) {
			System.out.println(string);
		}

		WeatherWSStub.GetWeather city_weather = new WeatherWSStub.GetWeather();
		city_weather.setTheCityCode("650");
		String[] localweather = weather.getWeather(city_weather).localGetWeatherResult.localString;
		for (String string : localweather) {
			System.out.println(string);
		}
		

	}

}



좋은 웹페이지 즐겨찾기