C # Call webservice (1 ),
I have been engaged in network programming recently. This article is about webservice. I am going to write two examples.
This article describes how to query the destination location of the mobile phone number and how to query the ticket in the next article.
This website (http://www.webxml.com.cn/zh_cn/index.aspx) provides several free web Services. The following is the result: (including C # webservice (2) some code is as follows:
1 private void button1_Click(object sender, EventArgs e) 2 { 3 ServiceReference1.MobileCodeWSSoapClient ww = new ServiceReference1.MobileCodeWSSoapClient("MobileCodeWSSoap"); 4 label1.Text = ww.getMobileCodeInfo(textBox1.Text,""); 5 } 6 7 private void button2_Click(object sender, EventArgs e) 8 { 9 ServiceReference1.MobileCodeWSSoapClient ww = new ServiceReference1.MobileCodeWSSoapClient("MobileCodeWSSoap");10 string[] s = new string[1000];11 s = ww.getDatabaseInfo();12 for (int i = 0; i < 361; i++)13 {14 listBox1.Items.Add(s[i]);15 }16 }
The web service called: http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx
There are two functions: getMobileCodeInfo () getDatabaseInfo ()
For how to use functions, see the case