• 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. }  
  • 相关阅读:
    python3.6入门到高阶(全栈) day013-014 内置函数
    python3.6入门到高阶(全栈) day012 生成器
    PHP数组基本排序算法和查找算法
    02 LAMP环境下安装WordPress
    02 React Native入门——Hello World
    01 React Native入门——环境安装部署
    02 “响应式Web设计”——媒体查询
    01 “响应式Web设计”——概述
    01 Portal for ArcGIS 10.7安装部署教程(windows环境)
    06 spring boot入门——AJAX请求后台接口,实现前后端传值
  • 原文地址:https://www.cnblogs.com/huqingyu/p/959708.html
Copyright © 2020-2023  润新知