⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex-16-03

📁 Programming Csharp Source Code(代码) Programming Csharp Source Code
💻
字号:
// Example 16-03: Sample client code to access the calculator web service

using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.Web.Services;

namespace WSCalc
{
   [System.Web.Services.WebServiceBindingAttribute(
       Name="Service1Soap", 
       Namespace="http://www.libertyAssociates.com/webServices/")]
   public class Service1 : 
      System.Web.Services.Protocols.SoapHttpClientProtocol 
   {
    
      public Service1() 
      {
         this.Url = 
              "http://localhost/webforms/wscalc/service1.asmx";
      }
    
      [System.Web.Services.Protocols.SoapDocumentMethodAttribute(
          "http://www.libertyAssociates.com/webServices/Add", 
          RequestNamespace=
            "http://www.libertyAssociates.com/webServices/", 
          ResponseNamespace=
             "http://www.libertyAssociates.com/webServices/", 
          Use=System.Web.Services.Description.SoapBindingUse.Literal, 
          ParameterStyle=
             System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
      public System.Double Add(System.Double x, System.Double y) 
      {
         object[] results = this.Invoke("Add", new object[] {x,y});
         return ((System.Double)(results[0]));
      }
    
      public System.IAsyncResult 
         BeginAdd(System.Double x, System.Double y, 
         System.AsyncCallback callback, object asyncState) 
      {
         return this.BeginInvoke("Add", new object[] {x,
                    y}, callback, asyncState);
      }
    
      public System.Double EndAdd(System.IAsyncResult asyncResult) 
      {
         object[] results = this.EndInvoke(asyncResult);
         return ((System.Double)(results[0]));
      }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -