Upload
ramaneesh
View
269
Download
0
Embed Size (px)
Citation preview
8/20/2019 About Details of ODATA
1/22
8/20/2019 About Details of ODATA
2/22
Objectives
At the end of this module, you will be able to:
OData in a NutshellAugust 20111st OctoberIn OData Nutshell2011 August
..Understand the OData Standard and how it works...Understand how OData uses the Atom Protocol...Understand how to pass input parameters to OData Services.
© 2011 SAP AG. All rights reserved. 2RKT
8/20/2019 About Details of ODATA
3/22
What is the Open Data Protocol?
Gateway CoreTechnology OData with SAP AnnotationsRESTServiceAdaptationMetadataRepositoryServiceAdaptationSupportabilityMonitoringSecurityBased on industry standardsOData for SAP
REST-based architectureHTTP, XML, Atom -
OData
-Based on the HTTP protocol
Atom
Atom is a combination of twostandardsXML
-Atom Syndication Protocol and AtomPublishing Protocol
HTTP
-XML Based
OData http://www.odata.org-Defines Data Types, ServiceMetadata, Service Runtime ODBC for the Web -Allows for Entity Relationships andDynamic Navigation
© 2011 SAP AG. All rights reserved. 3RKT
8/20/2019 About Details of ODATA
4/22
REST Representational State Transfer
REST is a set of architectural principals that can be used to define WebServices.
First introduced by Roy Fielding in his doctorial dissertation in the year 2000. HTTP protocol is an example of a system that implements the principles of REST...Uses HTTP verbs to communicate what action to take. Verbs map to CRUD methods:
© 2011 SAP AG. All rights reserved. 4RKT..URL is used to define the resource that is being acted upon. Example: http://servername:http_port/sap/customer/12345HTTP Verb CRUD MethodPOST CreateGET ReadPUT UpdateDELETE DeleteCustomer entity Customer ID 12345
8/20/2019 About Details of ODATA
5/22
Atom
Atom is the combination of two standards: Atom Syndication Format andAtom Publishing Protocol
Atom standards were originally created for publishing and subscribing to web basedcontent (news reports, blogs, etc.).
Atom Syndication Format
..Defines the format for document feeds.
..In OData, the documents are the data being acted upon (Business Objects, etc).
Atom Publishing Protocol
..
Defines how to read and maintain documents.
..Atom uses GET, POST, PUT, DELETE HTTP verbs as described the REST architecture.
© 2011 SAP AG. All rights reserved. 5RKT
8/20/2019 About Details of ODATA
6/22
ODBC for the Web
OData can be used to access table like structures much the same way ODBCdoes.
Entity Data Model (EDM) used to describe OData Services.EDM modeling tools available to model OData Services:
Each entity can support Create,Read, Update, and Delete (CRUD)operations
Can navigate relationshipsComplex Types supported
© 2011 SAP AG. All rights reserved. 6RKT
8/20/2019 About Details of ODATA
7/22
OData Metadata
OData defines a Metadata format based on the Entity Data Model in XML(edmx).
To access a services metadata document use the $metadata command:
The returned document is the services edmx metadata + SAP Metadata (S-Data):
© 2011 SAP AG. All rights reserved. 7RKT
8/20/2019 About Details of ODATA
8/22
Atom in OData Details
© 2011 SAP AG. All rights reserved. 8RKT
8/20/2019 About Details of ODATA
9/22
Atom in OData Details Continued
Atom FeedDefinedAtom Content the businessobject data© 2011 SAP AG. All rights reserved. 9RKT
8/20/2019 About Details of ODATA
10/22
Atom in OData Details Continued
Atom FeedDefinedAtom links where to getmore information about theentity© 2011 SAP AG. All rights reserved. 10RKT
8/20/2019 About Details of ODATA
11/22
OData for SAP Extra Metadata
OData for SAP is extra metadata that can be found in the services metadata
documentTo access a services metadata document use the $metadata alias:The returned document is the services edmx metadata + SAP Metadata (S-Data):OData for SAP contains: labels, annotations, etc.Extra metadata that can be accessed via SAP proxy generators.
© 2011 SAP AG. All rights reserved. 11RKT
8/20/2019 About Details of ODATA
12/22
OData Operations RetrieveEntitySet (QUERY)
OData defines a RetrieveEntitySet request to search for entities in an entityset. It returns a list of matching entities.
Use HTTP GET verb to retrieve a feed of entities from an entity set.The URL only contains the name of the entity set and any needed query stringparameters:http://usphlrig15.phl.sap.corp:8001/sap/iw/rest/odata/sap/BANKGEBOODATA/BankCollection
Query string parameters defined by OData:..$filter user for passing input parameters, example: $filter=airlineid EQ US
Other operators supported, GT, LT, AND, OR, etc. Learn more on OData website...$top used for getting the top X results, example: $top=5 returns the first 5 results..$skip used to skip ahead X number of entities in the returned list, example: $skip=5, skips
the first 5 results in the list.
Often combined with $top to page thru a list, example: $top=5&$skip=5 returns the second 5 resultsin the list...Many others defined by OData. Note: not all supported by Gateway.
© 2011 SAP AG. All rights reserved. 12RKT
8/20/2019 About Details of ODATA
13/22
OData Operations RetrieveEntity (READ)
The RetrieveEntity operation returns the details of a specific entity.
Use HTTP GET verb to execute the RetrieveEntity operation.The URL of the RetrieveEntity operation is just the RetrieveEntitySet operationURLwith the addition of the key properties
Note: Each Entity returned by the RetrieveEntitySet operation will contain an HREFlink to the RetrieveEntity operation for that entity:
© 2011 SAP AG. All rights reserved. 13RKT
8/20/2019 About Details of ODATA
14/22
OData Operations InsertEntity (CREATE)
The InsertEntity operation creates an entity.
Use HTTP POST verb to execute the InsertEntity operation.The URL used to execute the InsertEntity operation is the exact same used forexecuting the RetrieveEntitySet operation.
The Request Header most include the attribute x-requested-with:The Body of the request must contain the Atom Entry that represents the business entity to be created:
© 2011 SAP AG. All rights reserved. 14RKT
8/20/2019 About Details of ODATA
15/22
OData Operations InsertEntity Continued
The InsertEntity operation creates an entity.Successful execution of the operation returns HTTP 201 status code along with thelocation of the newly created entity will be returned.
Successful Response Header:Successful Response Body:
© 2011 SAP AG. All rights reserved. 15RKT
8/20/2019 About Details of ODATA
16/22
OData Operations UpdateEntity (UPDATE)
The UpdateEntity operation updates an entity.
Use HTTP PUT verb to execute the UpdateEntity operation.
The URL used to execute the UpdateEntity operation is the exact same used forexecuting the RetrieveEntity operation.The Request Header most include the attribute x-requested-with:
The Body of the request must contain the Atom Entry that represents the business entity to be updated:
© 2011 SAP AG. All rights reserved. 16RKT
8/20/2019 About Details of ODATA
17/22
OData Operations UpdateEntity Continued
The UpdateEntity request changes an entity.
If the update is successful, the server responds with:Successful Response Header 204 HTTP Response Code:
As the response code text above signifies, no data is returned in the Response
Body:© 2011 SAP AG. All rights reserved. 17RKT
8/20/2019 About Details of ODATA
18/22
Summary
You should now be able to..Understand the OData Standard and how it works...Understand how OData uses the Atom Protocol...Understand how to pass input parameters to OData Services.
© 2011 SAP AG. All rights reserved. 18RKT
8/20/2019 About Details of ODATA
19/22
© 2011 SAP AG. All rights reserved
No part of this publication may be reproduced or transmitted in any form or forany purposewithout the express permission of SAP AG. The information contained herein may bechanged without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietarysoftware components of other software vendors.
Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks ofMicrosoftCorporation.
IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x,System z, System z10, System z9, z10, z9, iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server,
PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER,OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS, HACMP,RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX, IntelligentMiner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks ofIBM Corporation.
Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks orregistered
trademarks of Adobe Systems Incorporated in the United States and/or other countries.
Oracle is a registered trademark of Oracle Corporation.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin aretrademarks or registered trademarks of Citrix Systems, Inc.
HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, WorldWide Web Consortium, Massachusetts Institute of Technology.
Java is a registered trademark of Sun Microsystems, Inc.
JavaScript is a registered trademark of Sun Microsystems, Inc., used under license fortechnology invented and implemented by Netscape.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP BusinessObjects Explorer,StreamWork, and other SAP products and services mentioned herein as well as thei
8/20/2019 About Details of ODATA
20/22
rrespective logos are trademarks or registered trademarks of SAP AG in Germany and othercountries.
Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, CrystalDecisions, Web Intelligence, Xcelsius, and other Business Objects products and servicesmentioned herein as well as their respective logos are trademarks or registeredtrademarksof Business Objects Software Ltd. Business Objects is an SAP company.
Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere, and other Sybaseproducts and services mentioned herein as well as their respective logos are trademarks orregistered trademarks of Sybase, Inc. Sybase is an SAP company.
All other product and service names mentioned are the trademarks of their respectivecompanies. Data contained in this document serves informational purposes only. Nationalproduct specifications may vary.
The information in this document is proprietary to SAP. No part of this document may bereproduced, copied, or transmitted in any form or for any purpose without the express priorwritten permission of SAP AG.
This document is a preliminary version and not subject to your license agreement or anyother agreement with SAP. This document contains only intended strategies, developments,and functionalities of the SAP® product and is not intended to be binding upon SAP to any
particular course of business, product strategy, and/or development. Please note that thisdocument is subject to change and may be changed by SAP at any time without notice.
SAP assumes no responsibility for errors or omissions in this document. SAP does notwarrant the accuracy or completeness of the information, text, graphics, links,or other itemscontained within this material. This document is provided without a warranty ofany kind,either express or implied, including but not limited to the implied warranties of
merchantability, fitness for a particular purpose, or non-infringement.
SAP shall have no liability for damages of any kind including without limitation direct, special,indirect, or consequential damages that may result from the use of these materials. Thislimitation shall not apply in cases of intent or gross negligence.
The statutory liability for personal injury and defective products is not affected. SAP has no
8/20/2019 About Details of ODATA
21/22
control over the information that you may access through the use of hot links contained inthese materials and does not endorse your use of third-party Web pages nor provide anywarranty whatsoever relating to third-party Web pages.
© 2011 SAP AG. All rights reserved. 19RKT
8/20/2019 About Details of ODATA
22/22