O'Reilly logo

A Programmer's Guide to .NET by Alexei Fedorov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required