oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

Build a Simple Web Service
Pages: 1, 2

Using the Web Service

Before we can use our Service1 web service, we need to do a full compile. This is done by using the "Build" command from the "Build" menu in Visual Studio .NET. Once the project has been built, Visual Studio .NET has created a formal XML definition of our Service1 WebService (a SDL contract) and a page that allows us to invoke our Service1 web methods. To go to that page, you can either "Start" your web service from the Debug menu of Visual Studio .NET or you can go to the Service1.asmx page on your local PC. When you start the project, you will see a page like this:

Screen shot.

To invoke one of the methods, simply type in some parameter values for the method and click on the "Invoke" button. In this example, we're going to invoke the add method and pass in parameters 3 and 5:

Screen shot.

Once you invoke the add method, you will see a resulting page that will look like this:

Screen shot.

Note that the number 8 is the result of adding 3 and 5.

.NET Framework Essentials.NET Framework Essentials
By Thuan Thai & Hoang Lam
June 2001
0-596-00165-7, Order Number: 1657
320 pages, $29.95

Where Do I go Next?

You can use web services from VB and C# applications as well as ASP.NET web pages and any other programming language that conforms to the web service standards. In a future article, I will show you how to use the MathLibrary web service we developed from a Visual Basic.NET Windows application.

Hamid Shojaee is a Senior Consultant with Microsoft Consulting Services and co-founder of Vitrix Corporation -- a time and attendance software company specializing in web-based time tracking solutions.

Return to the .NET DevCenter.