15.5. Creating a web service

ASP.NET web services can be created with any tool you prefer – from “traditional” Notepad to Microsoft Visual Studio.NET or other third-party tools. The only required file to create a web service is an .asmx file – it tells the web server that this is a web service and it will interpret it accordingly. Here is the code for a very simple web service that accepts a user’s name and returns a greeting which includes the supplied name:

<%@ WebService Language="VB" Class="WSDemo" %> 
Imports System 
Imports System.Web.Services 

Public Class WSDemo : Inherits WebService 

<WebMethod(Description:= "Greets the user")> _ Public Function SayHello(Name As String) As String Dim Greeting As String If Name <> "" Then Return "Hello ...

Get A Programmer's Guide to .NET now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.