Advantages And Uses Of Web Services In C#

Today, I am going to explain, what are web service in .NET with advantages and uses.. I will also explain how web services came in picture and before web services which technology worked.

What is web service

Web Service is an application or we can say a standard way for interacting directly with other applications over the internet. It is a way to develop interoperable application over the internet.

Web Service can locate on same computer within same network or different computer with different network. Web service is protocol independent, language independent and platform independent. Web services support standard protocol and data format like HTTP, XML, and SOAP.

web service

How web services came in picture

Before web service there were two more technologies in picture,


COM is known as Component Object Model. It allows interacting two objects on the same computer or machine but application can be different. We cannot use different application located on different computer using COM. It was the limitation of COM.


To remove limitation of COM, a new technology introduced known as DCOM. DCOM is short form of Distributed Component Object Model. Using DCOM we can access two different application or object on different computer but both applications must be on same network. This was the limitation of DCOM.

Web Service

To remove limitation of DCOM new interoperable technology came in picture known as Web service that allow us to interact with other object or application which is located on different network.

  1. using System;  
  2. using System.Collections;  
  3. using System.ComponentModel;  
  4. using System.Data;  
  5. using System.Linq;  
  7. using System.Web;  
  8. using System.Web.Services;  
  9. using System.Web.Services.Protocols;  
  11. using System.Xml.Linq;  
  13. namespace StockService  
  14. {  
  15.     // <summary>  
  16.     // Summary description for Service1  
  17.     // <summary>  
  19.     [WebService(Namespace = "")]  
  20.     [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]  
  21.     [ToolboxItem(false)]  
  23.     // To allow this Web Service to be called from script,   
  24.     // using ASP.NET AJAX, uncomment the following line.   
  25.     // [System.Web.Script.Services.ScriptService]  
  27.     public class Service1 : System.Web.Services.WebService  
  28.     {  
  29.         [WebMethod]  
  31.         public string HelloWorld()  
  32.         {  
  33.             return "Hello World";  
  34.         }  
  35.     }  
  36. }  
Advantage of web services

Web services use XML format message to interact with other system. Xml format is a standard way to communicate between two incompatible systems. Web service sent message over HTTP protocol. So, message reaches to any system over internet without being blocked by firewall.

What is WSDL

WSDL means Web Services Description Language. Web services description language tell to client what types of message it accept and what will be returned as an output. WSDL contain every detail of web services like what is communication protocol method name, data type used.

Advantage of web service


If you want to know more please click here.

Thanks for reading this article, hope you enjoyed it.


Similar Articles