Consuming a Service Created with Web Matrix
(Page 1 of 5 )
In an earlier article, I discussed the details involved in creating a web service using the Web Matrix. This tutorial is about creating consumers of those services.
Introduction
There are a couple of alternatives that can be used to access the web services created using Web Matrix. Two of the methods depend on the usage of VS 2003 IDE. A third method is probably more useful for those who do not have access to VS 2003. In the first method, where you have access to VS2003, you would reference the WSDL obtained by referencing the Web Service ASMX file with the mini-web server connected and running. In the second, you would import the web service file created in Web Matrix to a VS 2003 IDE project and generate the necessary files so that the web service becomes a part of the VS Project.
Importing a Web Matrix Web service into VS 2003 Project: the Web Matrix Service FileThe following web service file from web matrix, which happens to be the default project with the Web Method Add (), shown in Fig.1, was used. If a client provides two numbers, the service adds them up and returns the result to the client.
Fig.1

Importing into VS 2003 Project
This file is now imported into a VS 2003 project called FindJay, which has its own web service file, Service1.asmx. This file is not of interest to us for this part of the discussion. At the time of importing you will be notified that a class file does not exist, and one has to be created. If you agree to this the file will be imported. The file structure in the project appears as shown in Fig.2. Notice that the imported test.asmx file has neither a design view, nor a code view. It only has the imported text.
Fig.2
However, the test.asmx file is fully functional as seen in Fig.3. A WSDL reference to this file can be established by simply appending "? Wsdl" to the URL shown in the figure.
Fig.3

Next: Creating a client to the web service file >>
More Visual Basic.NET Articles
More By Jayaram Krishnaswamy