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. }  
  • 相关阅读:
    WPF Image控件的Source属性是一个ImageSource对象
    wx:if 与hidden
    切换远程分支
    异步请求(简单一说)
    多维数组降维方法,简单一提
    3.25发版之最后的搜索框
    wepy-城市按字母排序
    new一个新对象。。。对象???
    参数函数是对象的理解
    群辉 MariaDB 10 远程连接
  • 原文地址:https://www.cnblogs.com/huqingyu/p/959708.html
Copyright © 2011-2022 走看看