Web Service & Client

来源:互联网 发布:开淘宝代理货源怎么找 编辑:程序博客网 时间:2024/05/17 21:46

 

 [Web Client using Console]

> Wsdl http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?WSDL

 

Copy WeatherWebService.cs to Solution and add it

using System;using System.Collections.Generic;using System.Text;namespace weather{    class Program    {        static void Main(string[] args)        {            string strName = null;            if (args.Length > 0) strName = args[0];            else strName = "上海";            WeatherWebService wws = new WeatherWebService();            string[] info = wws.getWeatherbyCityName(strName);            Console.WriteLine("省份:/t/t{0}", info[0]);            Console.WriteLine("城市:/t/t{0}", info[1]);            Console.WriteLine("最后更新时间:/t{0}", info[4]);            Console.WriteLine("今日气温:/t{0}", info[5]);            Console.WriteLine("明日气温:/t{0}", info[12]);            Console.WriteLine("后天气温:/t{0}", info[17]);            Console.ReadLine();        }    }}
原创粉丝点击