动态调用http://www.webxml.com.cn/WebServices/WeatherWebService.asmx提供Web服务获取天气预报的示例。这个示例稍加改造,利用中移动139邮箱邮件短信提醒功能,就可以做成一个自动发送天气预报短信的小程序.很方便……
下面是程序代码:
private void GetWeather()
{
string url = "http://www.webxml.com.cn/WebServices/WeatherWebService.asmx";
string methodName = "getWeatherbyCityName";
object[] args = new object[1];
args[0] = "合肥";
String[] str = WebServiceHelper.InvokeMethod<String[]>(url, methodName, args);
this.message.InnerHtml = str[6] + " " + str[5] + "<br />" + str[7] + "<br />" + str[10];
}