zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    DEDE后台登录提示成功但是一下子就弹出重新登录
    商务通对话窗口左侧图片广告
    html文档类型能直接改成html5吗?
    <meta http-equiv="pragma" content="no-cache"/>是什么意思?
    <meta name="location" content="province=湖北;city=襄阳;coord=112.167975,32.047654">
    取消百度转码<head></head>
    <base target=_blank>
    把数据保存到数据库主表 `#@__archives` 时出错
    DEDECMS后台文章编辑内容框消失解决方法
    【转】vs 常用快捷键
  • 原文地址:https://www.cnblogs.com/YK2012/p/6686376.html
Copyright © 2011-2022 走看看