Sie sind auf Seite 1von 4

Open Data Protocol (OData)

Suppose a Web application wishes to expose its data to apps on mobile phones, for
instance. Without some common way to do this, the Web application must implement its own
approach, forcing every client app developer that needs its data to support this.
Take other example where we need to connect various BI tools with different data sources to
answer business questions. If every data source exposes data in a different way, analyzing
that data with various tools is hard.
The conclusion is We need a common approach to expose data in a simple and
standard way. That's exactly why OData was created.

OData (Open Data Protocol) is an open protocol for sharing data. In other words - OData
defines an abstract data model and a protocol that let any client access information exposed
by any data source.

The fundamental idea is that any OData client can access any OData data source. Rather
than creating unique ways to expose and access data, data sources and their clients can
instead rely on the single solution that OData provides.

OData Architecture:

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:

OData Model is used to represent the data from different data source in single format using
Entity Data model (EDM).
OData Service:

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:

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.
JavaScript: OpenUI5 library maintained by SAP
And many more.
Introduction to SAP HANA XS, we also explained that SAP HANA XS can be used to expose
data from Tables, Views and Modeling Views to UI layer.
In HANA XS, there are major 2 ways to expose data the data to clients OData and XSJS.
In this article we will talk about OData.

An OData service exposes data stored in database tables or views as OData collections for
analysis and display by client applications.
The client can be web browser, or SAPUI5 application or HTML5 application or any other
application which supports OData.

An OData service for SAP HANA XS is defined in a text file with the file suffix .xsodata, for
example, OdataSrvDef.xsodata.

The XSODATA services are great because they provide a large amount of functionality with
minimal amounts of development effort.

Important points on HANA OData Service (XSODATA):

SAP HANA XS currently supports OData version 2.0


OData defines operations on resources using RESTful HTTP commands (for
example, GET, PUT, POST, and DELETE).
Data is transferred over HTTP using either the Atom (XML) or
the JSON (JavaScript) format.
For modification operations, for example, CREATE, UPDATE, and DELETE,
SAP HANA XS supports only the JSON format
(content-type: application/json)
Create connection for hana database
You can open editor, catalog, settings, service
Under catalog you can create schema under schema you have to create table
After creating table open editor
Under this create a package under this create application for using odata
Create a file with extension .xsodata under this file
Add code
service {
"SAP_HANA"."Product" as "Product";
}
Using this Product table will be exposed to odata service and activate this file or
project and run thi s file.

After doing this your odata has been created now you can use this in you project.

Das könnte Ihnen auch gefallen