Choose between Web API and WCF

=> You can choose the Web API when you want to create the service that uses all the HTTP features, such as request and response header, URIs, versioning etcetera.
=> You choose the Web API if you want to expose the HTTP services to a broad range of clients. These includes the mobile , iPhone and browsers.
=> HTTP only. First-class programming model for HTTP. More suitable for access from various browsers, mobile devices etc enabling wide reach.
=> no support for higher level protocols such as Reliable Messaging or Transactions
=> Web API is the great framework for exposing your data and service to different-different devices. Moreover Web API is open source an ideal platform for building REST-ful services over the .NET Framework


Difference b/w WCF and Web Services

=> WCF Supports various protocols like HTTP, HTTPS, TCP, Named Pipes and MSMQ while WebService Supports only HTTP, HTTPS protocols.

=> WCF Hosted in IIS, WAS (Windows Activation Service), Self-hosting, Windows Service while webservice Hosted only in IIS.

=> WCF Supports security, reliable messaging, transaction and AJAX and REST supports while webservice Support security but is less secure as compared to WCF.

=> WCF are faster than Web Services

=> In WCF Hash Table can be serialized but for webservice It can serializes only those collections which implement IEnumerable and ICollection.

=> WCF Supports XML, MTOM, Binary message encoding and webservices support XML and MTOM (Message Transmission Optimization Mechanism) encoding.

Main components of WCF

WCF Service is composed of three components:

=> Service class: It implements the service needed.
=> Host environment: is an environment that hosts the developed service.
=> Endpoints: are the connection points for the clients to connect to the service. Clients find the end points through three components like service contract, binding, and address.

Service Oriented Architecture

Service Oriented Architecture is a way to implement Distributed Computing,
It involves creating a number of services, where each service provide access or exposes, one or more resources via some predetermined mechanism.
Services are often, but not always, distributed on a network

1:- Standardized Service Contract:
Services express their purpose and capabilities via a service contract.

2:- Service Loose Coupling:
Coupling refers to a connection or relationship between two things

3:- Service Abstraction:
Service contracts only contain essential information

4:- Service Reusability:

5:- Service Autonomy:
capable consistently and reliably on runtime execution environment

6:- Service Statelessness:
minimize resource consumption by deferring
the management of state information when necessary

7:- Service Composability:
The ability to effectively compose services is a critical requirement for achieving some of the most fundamental goals of service-oriented computing