Friday, May 29, 2020

What is OData? (Part-3)


In my previous two blogs, I have covered the basics of how the Internet works, HTTP and what are REST-based services. So, now that we have laid the foundation we will start with understanding what is OData protocol.
Previous Blogs in the series:
What is OData?
“Open Data Protocol (OData) is an open data access protocol from Microsoft that allows the creation and consumption of query-able and interoperable RESTful APIs in a simple and standard way”.
The protocol enables the Clients to publish and manipulate the resource identified by URIs and defined in a data model using simple HTTP messages.
To put it in simple words, OData is an open source to exchange data over the Internet. The server hosts the data and clients can call this service to retrieve the resources and manipulate them. Servers expose one or more endpoints which are services that refer to the resources. Clients need to know these server-side endpoints to call the service to query or manipulate the data. The protocol is HTTP based and designed with a RESTful mindset which means it follows the constraints to be called as a RESTful service.
Since the protocol is HTTP based, any programming language with HTTP stack can be used to consume OData services. Existing Client-side libraries can be used to transform the JSON or ATOM payloads from the server into objects making programming simple. On the other hand, many libraries exists on the server-side to generate the payloads in ATOM or JSON from the existing data.
It is important to note that both Client-side and Server-side development can be in completely different programming languages till the time both are able to communicate via HTTP.
Clients consume the service to query and manipulate the data from OData Services and are also called as Consumers of OData Service.
Similarly, Servers that expose the OData services via endpoints are known as Producers of Odata services.
ODataProtocol.jpg
So, we now know that in OData protocol, the resources are exposed in two formats; XML based Atom and JSON.
A brief description of what is Atom ad JSON.
Atom is a combination of two protocols, Atom Syndication and Atom Publishing protocol. The Atom Syndication Format is an XML language used for web feeds, while the Atom Publishing Protocol (AtomPub or APP) is a simple HTTP-based protocol for creating and updating web resources.
JSON stands for JavaScript Object Notation is a lightweight data-interchange format. JSON is self-descriptive and easy to use and is completely language-independent.
Advantages with OData
There is a lot of data on the web today but lot of it is locked up in different specific applications or formats and different to access from outside. Many Organizations have now started exposing data using REST based services however, it is difficult to write applications which works with multiple data sources as each provider will expose the data in a slightly different way. OData service producer can expose its service along with metadata which contains the semantics for consumption. OData exploits common formats like XML, Atom, and JSON for communication which are commonly understood. Clients can now understand these OData services using generic tools and can combine information from multiple data sources.
Exposing your data with OData services comes with multifold advantages. For example, as we mentioned earlier, as a consumer, you need not worry about the programming language used by producer as long as the services are exposed as OData service.
ODataAdvantages.jpg

ODBC for the Web

ODBC (Open Database Connectivity) is a standard API to access the database management systems independent of the database management systems or operating systems. ODBC manages this by adding drivers between the Application layer and the DBMS to translate the queries fired by application into instructions which DBMS can understand.
OData has similarities with the ODBC in the sense that here, OData provides the middleware between producers and consumers to communicate data. There is a uniform way to consume data and is independent of the producer much like ODBC. The fact that OData is based on HTTP RESTful services makes it the ODBC for the Web!
In my next blog, I will talk about SAP Netweaver Gateway, SAP OData Channel and the main elements of an OData service.

No comments:

Post a Comment