Knowledge Management Banner

Knowledge Management Banner

Difference between WCF and Web API and WCF REST and Web Service

Difference between WCF and Web API and WCF REST and Web Service

l  Web Service
n  It is based on SOAP and return data in XML form.
n  It support only HTTP protocol.
n  It is not open source but can be consumed by any client that understands xml.
n  It can be hosted only on IIS.


l  WCF
n  It is also based on SOAP and return data in XML form.
n  It is the evolution of the web service(ASMX) and support various protocols like TCP, HTTP, HTTPS, Named Pipes, MSMQ.
n  The main issue with WCF is, its tedious and extensive configuration.
n  It is not open source but can be consumed by any client that understands xml.
n  It can be hosted with in the applicaion or on IIS or using window service.


l  WCF Rest
n  To use WCF as WCF Rest service you have to enable webHttpBindings.
n  It support HTTP GET and POST verbs by [WebGet] and [WebInvoke] attributes respectively.
n  To enable other HTTP verbs you have to do some configuration in IIS to accept request of that particular verb on .svc files
n  Passing data through parameters using a WebGet needs configuration. The UriTemplate must be specified
n  It support XML, JSON and ATOM data format.


l  Web API
n  This is the new framework for building HTTP services with easy and simple way.
n  Web API is open source an ideal platform for building REST-ful services over the .NET Framework.
n  Unlike WCF Rest service, it use the full featues of HTTP (like URIs, request/response headers, caching, versioning, various content formats)
n  It also supports the MVC features such as routing, controllers, action results, filter, model binders, IOC container or dependency injection, unit testing that makes it more simple and robust.
n  It can be hosted with in the application or on IIS.
n  It is light weight architecture and good for devices which have limited bandwidth like smart phones.
n  Responses are formatted by Web API’s MediaTypeFormatter into JSON, XML or whatever format you want to add as a MediaTypeFormatter.

No comments

Powered by Blogger.