代碼也是非常的簡單:
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
當然在這兩個程式裡都不要忘記添加進該Web引用,在本地產生SOAP代理,只不過有很多的工作都由VS.NET這個IDE給完成了。
如果是使用WebMatrix來編寫ASP.NET消費Web服務的話,可就有一番工作需要你自己完成了,這個等下次再講。