CSDN博客

img luoboqingcai

WebService的构造函数

发表于2004/10/8 10:04:00  1479人阅读

分类: WebService专题

好像无参的构造函数是必须地。
 1。public class Tool : System.Web.Services.WebService
 {
  public Tool(){
   InitializeComponent();
  }
  public Tool(string strUrl)
  {
      InitializeComponent();
  }
[WebMethod]
  public int Insert(string strKey,string strComment)
  { 。。。}
}

2。    Web References的reference.cs
public class Tool : System.Web.Services.Protocols.SoapHttpClientProtocol {
       
        /// <remarks/>
        public Tool() {
            this.Url = "http://localhost/NSPTool_WS/Tool.asmx";
        }

  public Tool(string s)
  {
   if(s == "")
    this.Url = "http://localhost/NSPTool_WS/Tool.asmx";
   else
    this.Url = @"http://" + s +@"/NSPTool_WS/Tool.asmx";
  }
......
}

阅读全文
0 0

相关文章推荐

img
取 消
img