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
  • 相关阅读:
    java数据库连接池dbcp的使用
    图片轮显效果大全
    W5500问题集锦(持续更新中)
    Gamma校正及其OpenCV实现
    GlusterFS源代码解析 —— GlusterFS 日志
    cocos2dx 以子弹飞行为例解说拖尾效果类CCMotionStreak
    leetcode__Convert Sorted List to Binary Search Tree
    昨天面试新浪 java试题
    linux概念之性能调优
    Java实现 黑洞数
  • 原文地址:https://www.cnblogs.com/YK2012/p/6686376.html
Copyright © 2011-2022 走看看