• WebService简介-02


    WebService-面向服务编程SOA

    WebService-远程通信

    运行效果:

    1:添加服务器引用http://www.webxml.com.cn/WebServices/WeatherWebService.asmx

    添加表格

    <?xml version="1.0" encoding="utf-8"?>
    <!--
      有关如何配置 ASP.NET 应用程序的详细信息,请访问
      http://go.microsoft.com/fwlink/?LinkId=169433
      -->
    <configuration>
      <system.web>
        <compilation debug="true" targetFramework="4.5" />
        <httpRuntime targetFramework="4.5" />
      </system.web>
      <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="WebService1Soap" />
            <binding name="WeatherWebServiceSoap" />
          </basicHttpBinding>
          <customBinding>
            <binding name="WeatherWebServiceSoap12">
              <textMessageEncoding messageVersion="Soap12" />
              <httpTransport />
            </binding>
          </customBinding>
        </bindings>
        <client>
          <endpoint address="http://localhost:50382/WebService1.asmx" binding="basicHttpBinding"
            bindingConfiguration="WebService1Soap" contract="ServiceReference1.WebService1Soap"
            name="WebService1Soap" />
          <endpoint address="http://www.webxml.com.cn/WebServices/WeatherWebService.asmx"
            binding="basicHttpBinding" bindingConfiguration="WeatherWebServiceSoap"
            contract="ServiceReference3.WeatherWebServiceSoap" name="WeatherWebServiceSoap" />
         
        </client>
      </system.serviceModel>
    </configuration>
    webConfig文件
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    namespace BBFJ.WebFormApp
    {
        public partial class Index : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                //ServiceReference1.WebService1SoapClient client = new ServiceReference1.WebService1SoapClient();
                //int sum = client.Add(3,6);
                //Response.Write(sum);
                //Response.Write(client.LoadUserInfoList());
    
                ServiceReference3.WeatherWebServiceSoapClient client = new ServiceReference3.WeatherWebServiceSoapClient();
                
                DataSet ds = client.getSupportDataSet();
                this.GridView1.DataSource = ds.Tables[0];
                this.GridView1.DataBind();
            }
        }
    }
    Index
  • 相关阅读:
    LaTeX公式编辑器
    早期和东京,京都大学高考试题
    猎犬追狐狸试题
    矩阵方程的计算求解(Matlab实现)
    高考压轴题
    何天成:从高联到IMO金牌,超详细数学竞赛学习方法
    几个精彩的数论问题
    高考试题网站
    泛函分析有什么好的教材?
    ifndef系列
  • 原文地址:https://www.cnblogs.com/YK2012/p/6686376.html
Copyright © 2020-2023  润新知