1 / 20

Web Service

Learn how to build a web service using ASP.NET that calculates the area of a rectangle. Using VB.NET, you'll set up an ASMX file with a public function called `area` which takes the length and width as parameters and returns the computed area. The guide covers the entire process: from writing the Web Service, implementing and testing it, to calling the service from a client application. Discover how to manage XML results and utilize web references for seamless integration in your projects.

kimama
Download Presentation

Web Service

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Web Service

  2. 建立Web Service網站

  3. .vb檔案 Web Service區塊

  4. .asmx檔案 以 ASP.NET 指示詞 WebService為開頭

  5. 建立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 計算方形面積

  6. 建置Web Service

  7. 執行Web Service

  8. 測試Web Service

  9. 傳回XML結果

  10. 呼叫使用Web ServiceASP.NET

  11. 呼叫使用Web Service 建立callWS網站

  12. 加入Web 參考(1)

  13. 加入Web參考(2)

  14. 呼叫使用Web Service

  15. 呼叫使用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

  16. 呼叫使用Web ServiceWindows Form

  17. 呼叫使用Web Service 建立callWS專案

  18. 加入Web 參考(1)

  19. 加入Web參考(2)

  20. 呼叫使用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

More Related