28.01.2013 Views

SAP HANA Developer Guide - Get a Free Blog

SAP HANA Developer Guide - Get a Free Blog

SAP HANA Developer Guide - Get a Free Blog

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The main aim of OData is to define an abstract data model and a protocol which, combined, enable any client to<br />

access data exposed by any data source. Clients might include Web browsers, mobile devices, businessintelligence<br />

tools, and custom applications (for example, written in programming languages such as PHP or Java);<br />

data sources can include databases, content-management systems, the Cloud, or custom applications (for<br />

example, written in Java).<br />

The OData approach to data exchange involves the following elements:<br />

● OData data model<br />

Provides a generic way to organize and describe data. OData uses the Entity 1 Data Model (EDM).<br />

● OData protocol<br />

Enables a client to query an OData service. The OData protocol is a set of interactions, which includes the<br />

usual REST-based create, read, update, and delete operations along with an OData-defined query language.<br />

The OData service sends data in either of the following ways:<br />

○ XML-based format defined by Atom/AtomPub<br />

○ JavaScript Object Notation (JSON)<br />

● OData client libraries<br />

Enables access to data via the OData protocol. Since most OData clients are applications, pre-built libraries<br />

for making OData requests and getting results reduces and simplifies work for the developers who create<br />

those applications.<br />

A broad selection of OData client libraries are already widely available, for example: Android, Java, JavaScript,<br />

PHP, Ruby, and the best known mobile platforms.<br />

● OData services<br />

Exposes an end point that allows access to data in the <strong>SAP</strong> <strong>HANA</strong> database. The OData service implements<br />

the OData protocol (using the OData Data Services runtime) and uses the Data Access layer to map data<br />

between its underlying form (database tables, spreadsheet lists, and so on) and a format that the requesting<br />

client can understand.<br />

8.1.2 OData Service Definitions<br />

The OData service definition is the mechanism you use to define what data to expose with OData, how, and to<br />

whom. Data exposed as an OData collection is available for analysis and display by client applications, for<br />

example, a browser that uses functions provided by an OData client library running on the client system.<br />

To expose information by means of OData to applications using <strong>SAP</strong> <strong>HANA</strong> XS, you must define database views<br />

that provide the data with the required granularity. Then you create an OData service definition, which is a file you<br />

use to specify which database views or tables are exposed as OData collections.<br />

Note: <strong>SAP</strong> <strong>HANA</strong> XS currently supports OData version 2.0, which you can use to send OData queries<br />

(using the http GET method). Language encoding is restricted to UTF-8.<br />

An OData service for <strong>SAP</strong> <strong>HANA</strong> XS is defined in a text file with the file suffix .xsodata, for example,<br />

OdataSrvDef.xsodata. The file must contain at least the entry service {}, which would generate a<br />

completely operational OData service with an empty service catalog and an empty metadata file. However, usually<br />

you use the service definition to expose objects in the database catalog, for example: tables, SQL views, or<br />

calculation rules.<br />

In the OData service-definition file, you can use the following ways to name the <strong>SAP</strong> <strong>HANA</strong> objects you want to<br />

expose by OData:<br />

● Repository objects<br />

<strong>SAP</strong> <strong>HANA</strong> <strong>Developer</strong> <strong>Guide</strong><br />

Defining Web-based Data Access<br />

P U B L I C<br />

© 2012 <strong>SAP</strong> AG. All rights reserved. 165

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!