Most applications, especially mobile ones, require integration with external systems. If you are using Microsoft technologies, two prominent options for the back-end are the Windows Communication Foundation (WCF) and Web API. How would you decide what to use? Today, I’ll provide some insight in both of these options.

WCF is a unified .NET framework for building service-orientated applications. It was introduced in the .NET framework 3.0 and further extended in the .NET 3.5, 4.0 and 4.5 versions. It is a very mature implementation of a Service Oriented Architecture (SOA) and supports most of the WS-* standards, like WS-Security, WS-Discovery, WS-ReliableMessaging to name a few. It works with a variety of communication protocols such as HTTP, TCP, named-pipes, MSMQ, etc. The basics of WCF are the ‘address’, ‘binding’ and ‘contract.’ The address specifies the location of the service, the binding describes the connectivity requirements to the server and the contract specifies the functionality. WCF is highly extensible and as a developer, you can control almost every single aspect of the run time.

The question now is: do you always need all that power?

Web API is a framework that is an integral part of MVC 4, which enables you to build REST APIs. With the Web API, developers can obtain and act on business data by using REST, without creating complex SOAP requests. The request is a part of a URL (e.g. ‘′). The request will be issued by a client application, which will specify a HTTP verb for it. Common HTTP verbs are ‘GET,’ ‘POST,’ and ‘DELETE.’

Note that the users of the client app will probably not type the URL themselves. Instead, they will interact with the UI provided by the developer. The request hits the server, the back-end MVC 4 application, and a controller will process it. What’s special about this controller is that it’s not just a normal controller that inherits from the Controller build-in class, but it inherits from the ApiController.

If it was a ‘GET’ request, then an action that began with ‘GET’ would be executed and it would receive ’1001′ as the input. This ‘GET’ action would connect to a database, retrieve the details of product 1001 and send a JSON response back to the client app. If the same URL is requested with a ‘DELETE’  verb, then an action that begins with ‘DELETE’ would take care of deleting the product ’1001′. So, the development effort to build the Web API is reduced as well as the amount of data exchange between the client app and the server MVC application.

Building a Web API is straight forward but it should be no surprise that it does not provide all the same possibilities of a full blown framework like WCF. If your requirements can be fulfilled by a Web API, I would go for it. To learn more about building a Web API, I would recommend New Horizons’ 20486 - Developing ASP.NET MVC 4 Web Applications training program.