Yesterday, we discussed about creating a web service in .NET. On this post, we will focus on the other side of the process; How to consume web services using VB.NET. Consuming or using a web service is relatively easier than creating one. You can consume a web service from web application (ASP.NET) or just a desktop application (VB Forms). It is similar to how you reference a library class except you are trying to grab the library from internet or intranet resource.Procedure to consume web service in VB.NET:
1. Create new VB.NET project or VB.NET website
2. On the solution explorer, right click your VB project then select "Add Web Reference" from the menu.
3. On web reference form, enter the URL of web service you want to consume.

4. If you have entered the correct URL, it should show you the list of the web methods available to use. Now click the "Add Reference" button to add it to your project.
5. On your VB form or ASP.NET page, add a button and textbox then put the following code:
Dim sampleserv As New localhost.Service
TextBox1.Text = sampleserv.HelloFryan()
6. Now run the project. Click the button. It should display the following result:

For more web services tips and tricks, subscribe now
3 comments:
Thanks u r information
This helps. Thanks very much.
I cant get this done. I have a service called FLIGHT, with a class in it called FLIGHTo. i cant make it call FLIGHT.FLIGHTo, but i can make it call FLIGHT.FLIGHToSoapClient
Post a Comment