一、用   wsdl   /n:MyWeb   http://xxx.com/web/web1.asmx 生成一个web1.cs代理类文件  
   
  二、把web1.cs添加到web程序项目中,打开并修改它,  
  在它的类,修改它实例化的类成下面这种样子  
  public   class   web1   :   System.Web.Services.Protocols.SoapHttpClientProtocol   {  
                   
                  ///   <remarks/>  
                  public   web1(string   url)   {  
                          this.Url   =   url;//原来是一个http://xxx.com/web1/web1.asmx,现改成参数形式  
                  }  
   
  三、改一个asp.net项目的Web.config文件  
  在<configuration>一节中添加  
  <add   key="WebServiceUrl"   value="http://yyy.com/web/web.asmx"   />  
   
  四、在asp.net程序中调用Web服务  
  string   strUrl   =    
  System.Configuration.ConfigurationSettings.AppSettings["WebServiceUrl"].ToString();  
   
  MyWeb.web1   web   =   new   MyWeb.web1(strUrl);//实例化时动态调用一个Web   Service  
  string   strResult   =   web.Hello("world");   
   

相关文章:

  • 2022-12-23
  • 2022-02-07
  • 2021-10-15
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2021-12-11
猜你喜欢
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2021-09-04
  • 2021-09-18
  • 2021-11-17
相关资源
相似解决方案