Wednesday, 14 June 2006

ASP.NET : Web Service

Connecting an ASP.NET Webpage to an Existing Web Service


Create a new ASP.NET Web Application from Visual Studio.

Name the Application appropriately.

Add a Web Reference to the project and name it appropriately e.g.:
                        URL:        http://192.168.10.169/tcardserver/tcardserver.asmx
                        Name:        TcardService


Setup a variable to refer to this service e.g.:
                        Dim pxy As New TcardService.TcardService

Setup a button and label to allow testing of whether the service is available. Use the following code:
                        lblStatus.Text = pxy.online.ToString

To populate a datagrid, use code similar to the following:
                        dg1.DataSource = pxy.GetTcards
                        dg1.DataBind()

"Let the fear of danger be a spur to prevent it; he that fears not, gives advantage to the danger." - Francis Quarles

No comments: