Encoding/Decoding Web Service: Service Consumer - Service Consumer Creation 1-2-3
(Page 3 of 5 )
One: Start a project and add a web reference
Let's start a new project, a Windows application. Here it is called TestEncodeVB. The project comes with a default form, Form1, which we keep as is (though this is not a good practice). As it stands now, it has no link to any web service. We create a proxy class by adding a web reference. This reference is the reference to the asmx file we created for the web service described in part one. How do we do it? Right click the project and from the drop down, choose Add Web Reference... as shown in this picture.

This brings up the following dialogue, a utility screen for adding the proxy as shown in this picture. Web services proliferate on the network, local machine, and so on. You need to browse to the service, or you can use the UDDI directory to find the service. I encourage the reader to experiment with all the possibilities.

Since we know that the service exists on this machine at http://localhost/Test /Service1.asmx, we can go ahead and type this in at the URL. On the other hand, we may click on the drop-down arrow which will bring up all the services on the local machine, from which we choose the one that we are interested in as shown:

The program searches for the URL and if it succeeds, as in this case, it shows the location where it found the service, as shown.

Now just click the Add Reference... button, and this adds the web reference to your application as shown in the project view. Since the web reference is a part of the project, the proxy class is added to the project TestEncodeVB.:

Next: Two: Creating the user interface >>
More Visual Basic.NET Articles
More By Jayaram Krishnaswamy