220 likes | 350 Views
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)
E N D
.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 建立callWS網站
呼叫使用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 建立callWS專案
呼叫使用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