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 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.