国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

開(kāi)通VIP
動(dòng)態(tài)調(diào)用WebService的方法

通過(guò)在"Web引用"中的本地代理類中添加一個(gè)構(gòu)造函數(shù),這個(gè)構(gòu)造函數(shù)是以Web Service的URL為參數(shù)的重載方法實(shí)現(xiàn)動(dòng)態(tài)調(diào)用WebService。

在Visual Studio中添加Web Service引用時(shí),會(huì)生成一個(gè)Web References方件夾, 顯示這個(gè)文件夾中的所有文件,我們會(huì)發(fā)現(xiàn)Reference.cs文件,打開(kāi)這個(gè)文件,里面定義了一個(gè)從System.Web.Services.Protocols.SoapHttpClientProtocol繼承的類,在它的構(gòu)造函數(shù)中,有這樣的初始化語(yǔ)句: 

this.Url = http://localhost/webservice/MessageService.asmx;

 

我們只要增加一個(gè)帶有參數(shù)的構(gòu)造函數(shù),參數(shù)就是我們要引用的Web Service的url, 就可以實(shí)現(xiàn)動(dòng)態(tài)添加對(duì)Web Service的引用。

對(duì)于ASP.net 1.1
  1.     [System.Diagnostics.DebuggerStepThroughAttribute()]      
  2.     [System.ComponentModel.DesignerCategoryAttribute("code")]      
  3.     [System.Web.Services.WebServiceBindingAttribute(Name="MessageServiceSoap", Namespace="http://tempuri.org/")]      
  4.     public class MessageService : System.Web.Services.Protocols.SoapHttpClientProtocol {      
  5.         public MessageService(string serviceAddress) {      
  6.             this.Url = "http://localhost/webservice/MessageService.asmx";      
  7.         }      
  8.   
  9.         public MessageService(string serviceAddress) {      
  10.             this.Url = serviceAddress;      
  11.         }      
  12. }   
對(duì)于ASP.net 2.0
  1.     [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services""2.0.50727.42")]   
  2.     [System.Diagnostics.DebuggerStepThroughAttribute()]   
  3.     [System.ComponentModel.DesignerCategoryAttribute("code")]   
  4.     [System.Web.Services.WebServiceBindingAttribute(Name="MessageServiceSoap", Namespace="http://tempuri.org/")]   
  5.     public partial class MessageService : System.Web.Services.Protocols.SoapHttpClientProtocol {   
  6.         private System.Threading.SendOrPostCallback RegisterUserOperationCompleted;   
  7.         ……   
  8.         private System.Threading.SendOrPostCallback SendReplyMessageOperationCompleted;   
  9.         private bool useDefaultCredentialsSetExplicitly;   
  10.         public MessageService() {   
  11.             this.Url = "http://localhost:8023/webservice/MessageService.asmx";   
  12.             if ((this.IsLocalFileSystemWebService(this.Url) == true)) {   
  13.                 this.UseDefaultCredentials = true;   
  14.                 this.useDefaultCredentialsSetExplicitly = false;   
  15.             }   
  16.             else {   
  17.                 this.useDefaultCredentialsSetExplicitly = true;   
  18.             }   
  19.         }   
  20.   
  21.         public MessageService(string msurl)   
  22.         {   
  23.             this.Url = msurl;   
  24.             if ((this.IsLocalFileSystemWebService(this.Url) == true))   
  25.             {   
  26.                 this.UseDefaultCredentials = true;   
  27.                 this.useDefaultCredentialsSetExplicitly = false;   
  28.             }   
  29.             else  
  30.             {   
  31.                 this.useDefaultCredentialsSetExplicitly = true;   
  32.             }   
  33.         }   
  34. }  
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開(kāi)APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
c#webservice的簡(jiǎn)單示例
使?用?C?#?創(chuàng)?建?w?e?b?s?e?r?v?i?c?e?及?三?種?調(diào)?用?方?式
關(guān)于動(dòng)態(tài)引用WEB SERVICE的問(wèn)題
動(dòng)態(tài)加載Web Service
C#動(dòng)態(tài)調(diào)用Web服務(wù)的3種方法 - 51CTO.COM
學(xué)會(huì)使用Web Service上(服務(wù)器端訪問(wèn))
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服