Over View :
In this article we will discuss the behavior of web api when a request is made(Request) and an output it produces(Response).
The web API processing architecture can be divided into three Layers.
2.Message Handler Pipeline Layer.
3.Controller Handler Layer.
Hosting Layer :
This layer that is responsible for exposing the web API to outside world.The Hosting layer takes care of bridging the web API and HTTP infrastructure(HTTP Listener).
1.It is also responsible for creating HTTPRequestMessgae when HTTP Request is made and then pushing the request to next layer(Message Handler)
2.It is also responsible for converting the HTTPResponseMessage received from the Message Handler and then sending it as HTTP Response Message.
Mesaage Handler Layer:
A Message Handler acts a middle layer that performs operation over HTTPRequestMessage and HTTPResponseMessage.
For instance,when a response header is sent from the server,you would find a attribute named “Server” which contains the server name where the request was processed. All these kind of operation are done over this layer.
There are two important handlers in Message Handler :
Route Dispatcher :
This is essentially where we declare the routes of web API.(Routeconfig in MVC/WEB API).
- When a route is made and if it has the matching route defined in Route Config ,then the Route Dispatcher forwards it to the Controller Dispatcher.
- If there are no match in Route,Return 404.
Controller Dispatcher :
The Controller Dispatcher is responsible for calling the respective controllers in Web API. This Dispatcher acts as a bridge between Message Handler and Controller Handler.
The last and final layer where we write the concrete business logic methods.This layer includes functionalities like
Over All Architecture of WEB API :