Few days back, while going through a technical forum, I read the following…
“Why do we need WCF now? We can go for new ASP.NET Web APIs framework”
Actually, Windows Communication Foundation is designed to exchange SOAP-based messages using variety of transport protocols like HTTP, TCP, NamedPipes or MSMQ etc. While ASP.NET API is a framework for building non-SOAP based services over HTTP only.
Understanding the difference between the two technologies is the real purpose of this WCF Tutorial. This is a misconception about ASP.NET Web API framework that its going to replaceWCF. It’s just another way of building services that are non-SOAP based e.g. plain XML, JSON string etc. Also it has following advantages as:
- It allows us to create resource-oriented services using full features of HTTP.
- Exposing services to variety of clients easily like browsers, mobile devices etc.
WCF is still the best choice for:
- Messag Queuing scenario using MSMQ.
- One-way communication or Duplex communication
- If we intended to use transport other than HTTP e.g. TCP, UDP or Named Pipes.
::::: Free Practical Guide to WCF RESTful Services :::::
Following table further illustrate point by point difference between SOAP-based WCF Service and Web API.
|Protocol||Multiple Protocol Support.||Limited to HTTP only.|
|Format||SOAP is the default format. SOAP message has a specific format.||Web API renders string (Plain XML or JSON string).|
|Size||Heavy weight as SOAP message have more than just data.||Light weight as only required information is passed.|
|Principles||Follows WS-* specification.||Follows REST principles.|
Other Related Articles:
Top 10 Interview Questions and Answers Series:
- Top 10 WCF Interview Questions
- Comprehensive Series of WCF Interview Questions
- Top 10 HTML5 Interview Questions
- Top 10 ASP.NET Interview Questions
- Comprehensive Series of ASP.NET Interview Questions
- Top 10 ASP.NET MVC Interview Questions
- Top 10 ASP.NET Web API Interview Questions
- Top 10 ASP.NET AJAX Interview Questions