In Focus

Web Services In .NET

This blog will describe how to make web services.


To do anything,  first we should understand the basics of what we're trying to do. 


  • Any piece of software that makes itself available over the internet and uses a standardized XML messaging system.
  • A method of communication between two devices over a network.
  • A software system for an interoperable machine to machine communication.
  • A collection of standards or protocols for exchanging information between two devices or application.
  • Return types that can serializable directly as XML or JSON.
  • An interaction between two technologies.

There are mainly two types of web services.
  • SOAP web services.
  • RESTFul web services.


Create a simple web service application in Visual Studio using the following procedure:

Now our solution is ready,

  1. Add new item to right click project (1stWebService)
  2. Add Webservice and name it whatever you want.

  3. After adding CalCulator.asmx, you will see the following image.

  • Now If you will run this webservice then you will see “HelloWorld” method.

  • [WEBMETHOD] attribute shows that it will hit when it gets a response from the client site.

  • And name space -[using system.web service].

  • Check this service then press ctrl+F5, and you will see a window that contains the  "HelloWorld" method.

  • Now I will add new method here like this:

    1. public int ADD(int a, int b) {  
    2.     int c = a + b;  
    3.     return c;  
    4. }  


  • Save this and then run the solution.

Now Click on "Add" and you will see a window which contains two textboxes like this, it will automatically create.