Web Service
建立Web Service網站
.vb檔案 Web Service區塊
.asmx檔案 以 ASP.NET 指示詞 WebService 為開頭
建立Web Service <WebMethod()> _ Public Function area(ByVal length As String, ByVal width As String) As Integer Dim x, y As Integer x = Convert.ToInt32(length) y = Convert.ToInt32(width) Return x * y End Function 計算方形面積
建置Web Service
執行Web Service
測試Web Service
傳回XML結果
呼叫使用 Web Service ASP.NET
呼叫使用Web Service 建立callWS網站
加入Web 參考(1)
加入Web參考(2)
呼叫使用Web Service
呼叫使用Web Service Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim myService As myws.Service = New myws.Service Dim z As Integer z = myService.area(TextBox1.Text, TextBox2.Text) TextBox3.Text = z.ToString() End Sub
呼叫使用 Web Service Windows Form
呼叫使用Web Service 建立callWS專案
加入Web 參考(1)
加入Web參考(2)
呼叫使用Web Service Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim myService As myws.Service = New myws.Service Dim z As Integer z = myService.area(TextBox1.Text, TextBox2.Text) TextBox3.Text = z.ToString() End Sub