添加个项目,把这个web service添加到项目中,生成了代理之后调用方法即可再说这些方法也注释齐全

解决方案 »

  1.   

    http://download.csdn.net/detail/happy09li/4339886调用同类借口,做的个公交查询软件,,你可以下下来看看,,
    代码写的很清楚
      

  2.   

    添加WEB引用 比如引用名为:WebXml
    然后调用
    WebXml.ChinaTVprogramWebService tv = new WebXml.ChinaTVprogramWebService();tv.getTVprogramDateSet(theTVchannelID, theDate, userID);
      

  3.   

    使用方法第一步、使用 Visual Web Developer 建立一个 ASP.NET 网站。第二步、在解决方案上右键,选择 Add Web Reference。第三步、在弹出对话框中,输入 URL:http://webservice.webxml.com.cn/webservices/weatherws.asmx。第四步、编码。
    cn.com.webxml.www.WeatherWebService ws = new cn.com.webxml.www.WeatherWebService();
            string[] items = ws.getWeatherbyCityName("重庆");
            for (int i = 0; i < items.Length; i++)
            {
                Response.Write(i + "、" + items[i] + "<br>");
            }就这么简单,返回的结果是以数组的形式保存的,我们这里把这个数组的内容输出出来,便于我们查看每一项保存的是什么内容,以便决定使用哪一项。
      

  4.   

    在VS中对项目添加服务应用,根据里面的API进行操作即可。
      

  5.   

    要授权,我X,要User ID啊你那地址,又不是免费的
      

  6.   

    http://www.webxml.com.cn/WebServices/WeatherWebService.asmx
    免费的啊!!不需要钱的!!                string[] strArrs = new string[23];
                    Weather.WeatherWebServiceSoapClient w = new Weather.WeatherWebServiceSoapClient("WeatherWebServiceSoap");
                    strArrs = w.getWeatherbyCityName("惠州");
                    if (strArrs[8] == "")
                    {
                        this.lblTest.Text = "无法获取天气情况";
                    }
                    else
                    {
                        this.lblTest.Text = strArrs[1] + " " + strArrs[6];
                        this.img1.ImageUrl = @"~/Pic/" + strArrs[8];
                    }这个网站会提供一系列相关的天气显示图片,你先拷贝到项目中!
      

  7.   

    http://www.cnblogs.com/ChowYy/p/3382216.html看看这个吧,中国国家气象局开放的公共接口,这个免费,而且挺详细
      

  8.   

            private void button1_Click(object sender, EventArgs e)
            {
                weathertest2.Weather.WeatherWebServiceSoapClient w = new weathertest2.Weather.WeatherWebServiceSoapClient("WeatherWebServiceSoap");
                //把webservice当做一个类来操作
                string[] s = new string[23];//声明一个string数组存放其返回的结果
                string c = this.textBox15.Text.Trim();
                s = w.getWeatherbyCityName(c);
                textBox1.Text = s[0];
                textBox2.Text = s[1];
                textBox3.Text = s[2];
                textBox4.Text = s[4];
                textBox5.Text = s[5];
                textBox6.Text = s[6];
                textBox7.Text = s[7];
                textBox8.Text = s[10];
                textBox9.Text = s[12];
                textBox10.Text = s[13];
                textBox11.Text = s[14];
                textBox12.Text = s[17];
                textBox13.Text = s[18];
                textBox14.Text = s[19];
            }
      

  9.   

    天气预报接口的调用
    //创建ASP.NET Web服务
    //默认生成一个Web Service服务代码
    //在解决方案添加Web引用
    //在弹出的对话框中输入天气预报飞服务器地址
    //引用命名空间
    using System .Web .Services ;
    using obj; //引用
    //在网页中实例化
     obj.Service myobj = new obj.Service(); //实例化
    //加载调用自定义方法
     protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindPro();
                BindCity();
                BindWeather();
            }
        }
     // 获得省份
        protected void BindPro()
        {
            string [] pro=myobj.getSupportProvince();
            for (int i = 1; i <= Int32 .Parse (pro[0]); i++)
            {
                DropDownList1.Items.Add(new ListItem (pro[i].ToString (),pro[i].ToString()));
            }
        }
        //获得城市
        protected void BindCity()
        {
            DropDownList2.Items.Clear();
            string[] city = myobj.getSupportCity (DropDownList1 .SelectedValue );
            for (int i = 1; i <= Int32.Parse(city[0]); i++)
            {
                DropDownList2.Items.Add(new ListItem(city[i].ToString(), city[i].ToString()));
            }
        }
        //天气预报
        protected void BindWeather()
        {
            string[] mystr = myobj.getWeatherbyCityName(DropDownList2 .SelectedValue , theDayFlagEnum.Today);
            Label1.Text = mystr[1].ToString();
            Label2.Text = mystr[2].ToString();
            Label3.Text = mystr[3].ToString();
            Label4.Text = mystr[4].ToString();
            Label5.Text = mystr[5].ToString();
            Image1.ImageUrl = mystr[6].ToString();
        }