How Web Services Work

As you saw in the code, any method that you want to publicly expose is made available by adding the <WebMethod()> attribute to the method declaration. This makes the method automatically discoverable by anyone accessing the project's URL. Any class that has one or more methods marked with <WebMethod()> becomes a Web service. The Framework handles the task of setting up all the necessary hooks for the component to be callable via HTTP.

Most Web services will import the System.Web.Services namespace. This isn't necessary, but if you don't, you'll have to use the full System.Web.Services.<class> syntax to use any of the classes, such as the WebMethod you placed in front of your ConvertCurrency method. Many services also inherit ...

Get A Programmer's Introduction to Visual Basic® .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.