Web services

Why Web API is more efficient than Web Services?

Spread the love

To understand and give you a detailed analysis I have brought up this article fo you, where you can relate the two widely used services while designing any application.

Web Services

1.Web Service is a kind of application that is designed to interact directly with other applications, on any of the devices(mobile, laptop, notebook etc) over the internet. In a simple sense, Web Services are a means for interacting with similar or different over the Internet. The Web service consumers are able to invoke method calls on remote objects by using SOAP and HTTP over the Web. WebService is language independent and Web Services communicate by using standard web protocols and data formats, such as

2. For Ajax Call, we have to mention

routes.IgnoreRoute("{x}", new { x = @"..asmx(/.)?" }); instead of // routes.IgnoreRoute("{resource}.axd/{pathInfo}");

3.Used to have WSDL
4. We have to include [WebMethod] attribute to host and then we can collect in another project.
5. You have to go for hosting the projet as the functions and the values for ASMX file are only present if bot the projects re running and or the server has been hosted.

Web Api

Web API :

System.net.http – client and raw messaging types
System.Net.http.formatting – model binding and media type
System.Web.HTTP -Basic Hosting infrastructure
Stem.Web.http.common -Common APIs
System.Web.http.self-host -self-hosting
System.Web.http.Data -Data controller handling CRUD operation
System.Web.http.EntityFramework -implementation of a data controller
System.Web.http.Helper – Common code for data API

2. By default, Web API binds the incoming data to CLR types :
Body, header and or query string very similar to the model binding of ASP.NET MVC

3. Media type formatters are used to bind both input ad output mapped to content types.

4. Validations via attributes can also be used

5.HTTP request message and Http response message can be used to down further into the HTTP stack enables you to directly set headers

6. It handles automatic content negotiation for the most common scenarios automatically handles accept headers for XML or JSON

7. The configuration enables you to customize for others file extensions or query string common cases

8.Asp.net Web API includes automatic support for this syntax return Iqueryable instead of IEnumerable.

It provides a simple configuration model HttpConfiguration class
Global configuration.configuration static object
It holds onto Dependency Resolver IOC mechanism, Enhances Testability and easy to build unit tests.


  • Multiple hostings
  • Within Asp.net applications inside IIS
  • Self-hosted within any custom app (console, Windows Services, etc)
  • IIS Express or Cassini (VS Web Server ) for development
  • Same programming model

12. Web API provides a simple but Extensible way to build Http services

Restful services can be built when using extra care HTTP Client is a new way of consuming Http endpoints


Representational State Transfer
Architecture For building systems (introduced by Roy Fielding ) i.e client side
Based on advantages of Web – applies on human web programmatically
Uniform Interface
Hypermedia drove i.e like
Cache ability and stateless- helps to handle a greater load

a. A restful service models its resources as URIs build on the success of the web
b.Everything is addressable via URI
c.You Interact with a resource by using the Uniform interface start with URI add well-known HTTP Verbs
14.Uniform Interface

No side Effect
Idempotent (Calling a million times has the same effect as one request )
Retrieves resources
Creates a new resource
Same as SOAP – Still unsafe (Simple Object Access protocol)-XML requests and responses
Updates an existing resource
also idempotent
Removes a resource
Also Idempotent

15.Implementing using Conventions
The route determines which Controller should be invoked based upon the request URI
Controller derives from ApiController
Method invoked is picked based on the verb os incoming requests

Also read:
20 Important jQuery interview questions for experienced
8 steps to a Reliable facebook graph api in website
C Tutorial: Let’s learn in a much easier way
Data Types Available In C

Leave a Reply

Your email address will not be published. Required fields are marked *