zoukankan      html  css  js  c++  java
  • C# SOAP 调用WebService

    1. Math</CODE> XML Web services 生成的代理类。在代理类的 <CODE>Add</CODE> 方法中,<B>Invoke</B> 方法正在调用 <CODE>Add</CODE> XML Web services 方法。<P></P><CODE>   
    2. namespace MyMath {   
    3.     using System.Diagnostics;   
    4.     using System.Xml.Serialization;   
    5.     using System;   
    6.     using System.Web.Services.Protocols;   
    7.     using System.Web.Services;   
    8.        
    9.        
    10.     [System.Web.Services.WebServiceBindingAttribute(Name="MyMathSoap", Namespace="http://www.contoso.com/")]   
    11.     public class MyMath : System.Web.Services.Protocols.SoapHttpClientProtocol {   
    12.            
    13.         [System.Diagnostics.DebuggerStepThroughAttribute()]   
    14.         public MyMath() {   
    15.             this.Url = "http://www.contoso.com/math.asmx";   
    16.         }   
    17.            
    18.         [System.Diagnostics.DebuggerStepThroughAttribute()]   
    19.         [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.contoso.com/Add", RequestNamespace="http://www.contoso.com/", ResponseNamespace="http://www.contoso.com/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]   
    20.         public int Add(int num1, int num2) {   
    21.             object[] results = this.Invoke("Add"new object[] {num1,   
    22.                         num2});   
    23.             return ((int)(results[0]));   
    24.         }   
    25.            
    26.         [System.Diagnostics.DebuggerStepThroughAttribute()]   
    27.         public System.IAsyncResult BeginAdd(int num1, int num2, System.AsyncCallback callback, object asyncState) {   
    28.             return this.BeginInvoke("Add"new object[] {num1,   
    29.                         num2}, callback, asyncState);   
    30.         }   
    31.            
    32.         [System.Diagnostics.DebuggerStepThroughAttribute()]   
    33.         public int EndAdd(System.IAsyncResult asyncResult) {   
    34.             object[] results = this.EndInvoke(asyncResult);   
    35.             return ((int)(results[0]));   
    36.         }   
    37.     }   
    38. }  
  • 相关阅读:
    查询AD账号的SID
    Linux下NFS搭建实验
    定制windows环境下cmd替代软件ConEmu
    [转载]硬盘MBR详细介绍
    HP_UX扩dump空间
    zero和null以及sparse
    Cisco MDS9222i光纤交换机最常用排错命令
    Brocade SAN Switch上简单配置AG
    RHEL环境下调试Shell脚本时遇到字符串转换整数的问题
    Brocade SAN SWITCH配置文件导出和恢复
  • 原文地址:https://www.cnblogs.com/huqingyu/p/959708.html
Copyright © 2011-2022 走看看