A Web service is a unit of managed code that can be remotely invoked using HTTP, that is, it can be activated using HTTP requests. So, Web Services allows you to expose the functionality of your existing code over the network.Web Services allows different applications to talk to each other and share data and services among themselves. Other applications can also use the services of the web services. For example VB or .NET application can talk to java web services and vice versa. So, Web services is used to make the application platform and technology independent.Web Services uses standardized industry standard protocol for the communication. All the four layers (Service Transport, XML Messaging, Service Description and Service Discovery layers) uses the well defined protocol in the Web Services protocol stack.
Web Services uses SOAP over HTTP protocol for the communication, so you can use your existing low cost internet for implementing Web Services.
ASP.NET Web Service file name has extension asmx and create a Web service project and add a file that is named MyWebService.asmx,
Following is the code in asmx file
<%@ WebService Language="C#" class="MyClass" %>
and the back end file is as shown below
using System.Web.Services ;
public class MyClass
public int Add ( int a, int b)
return a + b ;
The page directive WebService is required and class is the name of the .NET Class to expose the Web Service, each method exposes as Web Service Class Method need to have a declarative attribute statement [WebMethod()] in front of it.
Now your service is ready and There are many ways to consume Web Services
For more information you can use the link