Creating a Simple Web Service

Now that you have an understanding of the ASP.NET infrastructure, let's use it to create a simple Web service. Let's start by creating a simple Web service without the help of Visual Studio .NET so that you can understand all the constituent pieces of a Web service. The high-level steps are as follows:

1.
Create an asmx file that contains the source code for the Web service.
2.
Create an IIS virtual directory.
3.
Test.
4.
Create a client.

Create an asmx File for the Web Service

The following code shows the source for a very simple Web service. Save this code into a file called arithmetic.asmx.

 1. <%@ WebService Language="C#" class="Arithmetic" %> 2. using System.Web.Services; 3. class Arithmetic 4. { 5. [WebMethod] ...

Get .NET and COM Interoperability Handbook, The now with O’Reilly online learning.

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