Difference between Web Service and WCF and Web API

.Net provide different types of communication technologies like Web services, WCF Services and Web API.  You have many ways to design you services in .net framework. We are focusing some important points of services available in .net .






Web Service

Based on SOAP and return XML Data
Support only HTTP protocol. It support only HTTP protocol.
Consumed by client that able to understand xml SOAP Services.
Can host on IIS. It can be hosted only on IIS.
Easy to Learn and understand.

WCF

Based on SOAP and return XML Data. SOAP is heavy compare then JSON and its overhead over network also.
Enhanced version of web services support multiple protocols like TCP, HTTP, HTTPS, Named Pipes, MSMQ via configuration.
More reliable when both client and server have .Net.
Its implementation and configuration is complex
Consumed by client that able to understand xml SOAP Services.
Self-hosting, IIS and using windows services.
Can configure to Support REST over http need to enable webhttpbindings.
But Only support GET and POST verbs by [webget] and [wenbinvoke]
Complex to enable REST services in WCF.
WCF support XML, JSON and ATOM data format.


Web API (Web API 2.0)

Design specifically for building HTTP Restful Services on .Net Framework.
Web API easily readable and handy as JSON.
Support all features of HTTP Like URls, Request/Response, Headers, Caching and Versioning.
Web API support many HTTP Verbs like GET, POST, PUT, DELETE etc.
Web API is stateless.
Web API supports MVC features (controllers, action results, routing, filter, model binders, IOC container or dependency injection)
Web API can be self-hosted, hosted with in the application and on IIS.
OWIN (Open Web Interface for .NET) is used for self-Hosting.
Web API Support OData query options for sort, filter and page the of OData Query.
Web API design to consume by hand held devices easily. Because all modern mobile OS support JSON easily. It is good for devices which have limited bandwidth
Response can be design based on request, MediaTypeFormatter take care which type of format need to send.

Comments

Post a Comment