In the previous article Introduction to OData Service
, we explained what OData is and how it works.
In this article we will explain the architecture of OData.
Below diagram explains the high level architecture of the OData. There are four main parts of OData
- OData Model
- OData Service
- OData Protocol
- OData Client Libraries
OData Model is used to represent the data from different data source in single format using Entity Data model (EDM).
It is service layer on top of OData Model and it exposes an endpoint that allows client to access the data using OData Protocol and OData Client library.
It converts the different format of data source like SQL relation tables, SharePoint list, Windows Azure tables etc. into common format for client to use.
OData protocol lets a client make requests to and get responses from an OData service.
OData protocol is a set of RESTful interactions.
OData protocol is just like HTTP
and used to do CRUD operation by using OData. It transfers the data in form of XML or JSON.
OData Client Libraries:
OData Client Libraries are used by client application to access the data using OData Protocol.
Providing pre-built libraries for making OData requests and getting results makes life simpler for the developers who create those applications.
There are a number of OData client libraries available to access OData. Few of them are:
- Microsoft .NET Framework 3.51: the WCF Data Services framework is available as a separate download for .NET 3.x.
- Java: odata4j (including Java on an Android phone) supports the OData protocol.
- And many more.
Query Language Directly in URL:
OData provides an entire query language directly in the URL. Having a query language in the URL basically means that by changing the URL, the data returned from an OData feed (Data Source) also changes. Being able to control what data you get back from the consumer side means that the OData feed has complete control over what parts of the content to use.
HTTP methods in OData:
OData also offer more than just exposing content, it offers full CRUD support by using the different HTTP methods:
- GET: Gets one or many entries.
- POST: Create a new entry.
- PUT: Update an existing entry
- DELETE: Remove an entry.
Any platform that provides support for HTTP and XML is enough to form HTTP requests to interact with OData service.