天气预报WebService的使用。
/// <summary>
/// 获取天气数据调用WebServer(地址:http://www.ayandy.com 命名空间:www.ayandy.com)
/// </summary>
/// <param name="cityName">城市名称</param>
/// <param name="day">日期(1:今天 2:明天 3:后天)</param>
/// <returns>返回信息数组(1:城市 2:天气 3:温度 4:风向 5:日期 6:图标)</returns>
public String[] getWeather(String cityName, int day)
{
com.ayandy.www.Service mWeatherWebService = new com.ayandy.www.Service();//构造服务
String[] WeatherOfCity = new string[6];
switch (day)
{
case 1:
WeatherOfCity = mWeatherWebService.getWeatherbyCityName(cityName, com.ayandy.www.theDayFlagEnum.Today);//获取今天天气信息
break;
case 2:
WeatherOfCity = mWeatherWebService.getWeatherbyCityName(cityName, com.ayandy.www.theDayFlagEnum.Tomorrow);//获取明天天气信息
break;
case 3:
WeatherOfCity = mWeatherWebService.getWeatherbyCityName(cityName, com.ayandy.www.theDayFlagEnum.theDayafterTomorrow);//获取后天天气信息
break;
}
return WeatherOfCity;
}