标签:img span void null object 对话框 test tool ring
C#winForm调用WebService的远程接口
布局如图:
如:http://localhost:6677/webservice1.asmx
1 myWebServiceTest.WebService1SoapClient myWebService = null;
2 private void Form1_Load(object sender, EventArgs e)
3 {
4 myWebService = new myWebServiceTest.WebService1SoapClient("WebService1Soap");
5 }
6 private void button1_Click(object sender, EventArgs e)
7 {
8 textBox1.Text = myWebService.HelloWorld();
9 }
10
11 private void button2_Click(object sender, EventArgs e)
12 {
13 textBox2.Text = myWebService.GetStr(textBox3.Text);
14 }
访问WebService服务端的代码:
1 [WebMethod]
2 public string HelloWorld()
3 {
4 return "Hello World";
5 }
6
7
8 [WebMethod]
9 public string GetStr(string name)
10 {
11 return this.HelloWorld() + "-->:" + name;
12 }
标签:img span void null object 对话框 test tool ring
原文地址:http://www.cnblogs.com/bdqczhl/p/7400717.html