The web|window| client is designed to embody the xmlwebservice heterogeneous platform, independent of the system and device independent of the consumer's application type.
Shows students how to use C # to write a Windows program to consume the service:
The code is simple, just add the following lines:
private void Button1_Click (object sender, System.EventArgs e)
{
Get.service1 aa=new WS03. Get.service1 ();
String Score=aa. Getscore (ComboBox1.SelectedItem.ToString (), comboBox2.SelectedItem.ToString ()). ToString ();
Label3. text= "Student" +combobox1.selecteditem.tostring () + "" +combobox2.selecteditem.tostring () + "The result is:" +score;
}
Then use vb.net to write a asp.net program to invoke the service:
The code is also very simple:
Private Sub button1_click (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles Button1.Click
Dim AA as New [get]. Service1
Label1.Text = AA. Getscore (DropDownList1.SelectedItem.Text, DropDownList2.SelectedItem.Text)
End Sub
Private Sub button2_click (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles Button2.click
Dim AA as New [get]. Service1
Label2.Text = AA. Getaverage (DropDownList1.SelectedItem.Text)
End Sub
Private Sub button3_click (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles Button3.click
Dim AA as New [get]. Service1
Label3.text = AA. GetOrder (DropDownList1.SelectedItem.Text)
End Sub
Of course, in both programs, don't forget to add the Web reference and generate the SOAP proxy locally, but a lot of work is done by the Vs.net IDE.
If you're using WebMatrix to write a asp.net consumer Web service, there's a job you need to do for yourself, which you'll talk about next time.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.