SlideShare a Scribd company logo
GW100 SAP NetWeaver Gateway
Introduction to OData
May, 2012




                              INTE
                                  RNA
                                     L
Objectives



                          At the end of this chapter, you will understand:
                          Ÿ  The architecture of the Atom and OData protocols
                          Ÿ  How SAP NetWeaver Gateway makes use of OData
                          Ÿ  How to issue read-only OData requests from your browser




©  2012 SAP AG. All rights reserved.                                                    2
Agenda

u    Atom and OData – Building Towards a Business Interface
u    Gateway – OData for the Enterprise
u    Using Gateway – OData in Practice (Read Only)
         u    The QUERY operation – retrieving all or part of a collection
         u    The READ operation – retrieving a single entry from a collection
         u    Understanding the XML returned by the QUERY and READ operations
         u    Mapping OData properties to Atom elements




 ©  2012 SAP AG. All rights reserved.                                             3
Agenda

u    Atom and OData – Building Towards a Business Interface
u    Gateway – OData for the Enterprise
u    Using Gateway – OData in Practice (Read Only)
         u    The QUERY operation – retrieving all or part of a collection
         u    The READ operation – retrieving a single entry from a collection
         u    Understanding the XML returned by the QUERY and READ operations
         u    Mapping OData properties to Atom elements




 ©  2012 SAP AG. All rights reserved.                                             4
What is the Open Data Protocol (OData)?

OData is a Microsoft developed extension to the
Atom Publishing and Atom Syndication standards,
which in turn, are based on XML and HTTP(S).           SAP Annotations

It was designed to provide a standardised              OData
implementation of a RESTful API. In doing so, it
offers database-like access to server-side             Atom Publishing
resources. Hence, OData has been described as:
                                                       Atom Syndication
                            “ODBC for the Web”
It can be used freely without the need for a license   XML or JSON
or contract.
                                                       HTTP(S)
OData is also extensible. This allows SAP to
supplement the data types used by OData with
extra information from the ABAP Data Dictionary.


©  2012 SAP AG. All rights reserved.                                      5
What is Atom?


Atom is pair of standards
Atom Syndication Format                             SAP Annotations
-  An XML based description of the documents
    supplied by a website                           OData
-  These descriptions are typically consumed by
   content syndication websites                     Atom Publishing
-  In Atom terminology, a collection of documents
   is known as a “Feed”                             Atom Syndication
-  A Feed is compose of zero or more “Entries”
                                                    XML
Atom Publishing Format
-  An HTTP based protocol that allows the           HTTP
    manipulation of Atom Syndication documents

Atom Syndication and Atom Publishing are only partially RESTful protocols.

©  2012 SAP AG. All rights reserved.                                         6
What Does OData Add to Atom?

The Atom Publishing Format does not specify
how data should be encoded within a Feed;
                                                  SAP Annotations
therefore, it fails to be fully RESTful because
its messages are not self-describing.             OData
OData extends Atom by providing a metadata
description of the message.                       Atom Publishing
OData provides definitions for:
                                                  Atom Syndication
-  Simple Types
-    Complex Types                                XML
-    Associations between entries
-    Navigation Paths between entries             HTTP
-    Custom behaviour beyond the standard CRUD
     operations



©  2012 SAP AG. All rights reserved.                                 7
Output Formats Supported by OData

OData supports the use of either XML or JSON format messages.
{	
  "d":{	
  
	
  	
  "__count":”2",	
  
	
  	
  "results":[{	
  
	
  	
  	
  	
  "__metadata":{	
  
	
  	
  	
  	
  	
  	
  "uri":"http://ldcigkq.wdf.sap.corp:50080/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/CarrierCollection('AA')",	
  
	
  	
  	
  	
  	
  	
  "type":"RMTSAMPLEFLIGHT.Carrier",	
  
	
  	
  	
  	
  	
  	
  "content_type":"text/html",	
  
	
  	
  	
  	
  	
  	
  "media_src":"http://ldcigkq.wdf.sap.corp:50080/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/CarrierCollection('AA')/$value",	
  
	
  	
  	
  	
  	
  	
  "edit_media":"http://ldcigkq.wdf.sap.corp:50080/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/CarrierCollection('AA')/$value"},	
  
	
  	
  	
  	
  "carrid":"AA",	
  
	
  	
  	
  	
  "CARRNAME":"American	
  Airlines",	
  
	
  	
  	
  	
  "CURRCODE":"USD",	
  
	
  	
  	
  	
  "URL":"http://www.aa.com",	
  
	
  	
  	
  	
  "mimeType":"text/html",	
  
	
  	
  	
  	
  "carrierFlights":{	
  
	
  	
  	
  	
  	
  	
  "__deferred":{	
  
	
  	
  	
  	
  	
  	
  	
  	
  "uri":"http://ldcigkq.wdf.sap.corp:50080/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/CarrierCollection('AA')/carrierFlights"}}},	
  
	
  	
  	
  {"__metadata":{	
  
	
  	
  	
  	
  	
  	
  "uri":"http://ldcigkq.wdf.sap.corp:50080/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/CarrierCollection('JL')",	
  
	
  	
  	
  	
  	
  	
  "type":"RMTSAMPLEFLIGHT.Carrier",	
  
	
  	
  	
  	
  	
  	
  "content_type":"text/html",	
  
	
  	
  	
  	
  	
  	
  "media_src":"http://ldcigkq.wdf.sap.corp:50080/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/CarrierCollection('JL')/$value",	
  
	
  	
  	
  	
  	
  	
  "edit_media":"http://ldcigkq.wdf.sap.corp:50080/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/CarrierCollection('JL')/$value"},	
  
	
  	
  	
  	
  "carrid":"JL",	
  
	
  	
  	
  	
  "CARRNAME":"Japan	
  Airlines",	
  
	
  	
  	
  	
  "CURRCODE":"JPY",	
  
	
  	
  	
  	
  "URL":"http://www.jal.co.jp","mimeType":"text/html",	
  
	
  	
  	
  	
  "carrierFlights":{	
  
	
  	
  	
  	
  	
  	
  "__deferred":{	
  
	
  	
  	
  	
  	
  	
  	
  	
  "uri":"http://ldcigkq.wdf.sap.corp:50080/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/CarrierCollection('JL')/carrierFlights"}}}	
  
	
  	
  ],	
  
	
  	
  "__next":"http://ldcigkq.wdf.sap.corp:50080/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/CarrierCollection?$skiptoken=11"}	
  
}	
  




©  2012 SAP AG. All rights reserved.                                                                                                                           8
OData Service Documents – The Starting Point

An OData Service Document is a high level description of the server-side
resources that are available for manipulation. It is retrieved using a URL.
For example, issuing the URL http://odata.netflix.com returns:




©  2012 SAP AG. All rights reserved.                                          9
OData Service Documents – General Structure

                                                  The service tag defines a particular OData Service.
                       <service>	
  
                                                  This tag defines the starting point for service consumption.
                            1

                                                  The workspace tag contains a list of all server-side
                     <workspace>	
  
                                                  resources that are available for manipulation.

        1                                0..n

                                                            A collection tag identifies an
    <title>	
                          <collection>	
  
                                                            individual server-side resource.

                                            1


                                          <title>	
  


The <collection> tag will give you access to a server-side resource that can be
manipulated in some way. This could be a single table (hence “ODBC for the
Web”) or a set of business objects such as Sales Orders or Service Orders or
Customers etc.

©  2012 SAP AG. All rights reserved.                                                                             10
An Example of an OData Service Document – 1/2

<service	
  xml:base="http://odata.netflix.com/v2/Catalog/”	
  
	
  	
  	
  	
  xmlns:atom="http://www.w3.org/2005/Atom"	
  xmlns="http://www.w3.org/2007/app”>	
  
	
  	
  <workspace>	
  
	
  	
  	
  	
  <title>Default</title>	
  
	
  	
  	
  	
  <collection	
  href="Genres">	
  
	
  	
  	
  	
  	
  	
  <title>Genres</title>	
  
	
  	
  	
  	
  </collection>	
  
	
  	
  	
  	
  <collection	
  href="Titles">	
  
	
  	
  	
  	
  	
  	
  <title>Titles</title>	
                                                       The service tag defines
	
  	
  	
  	
  </collection>	
  
	
  	
  	
  	
  <collection	
  href="TitleAudioFormats">	
                                            an OData Service.
	
  	
  	
  	
  	
  	
  <title>TitleAudioFormats</title>	
  
	
  	
  	
  	
  </collection>	
                                                                       The parameters define
	
  	
  	
  	
  <collection	
  href="TitleAwards">	
  
	
  	
  	
  	
  	
  	
  <title>TitleAwards</title>	
                                                  the base URL for the
	
  	
  	
  	
  </collection>	
                                                                       service and which
	
  	
  	
  	
  <collection	
  href="People">	
  
	
  	
  	
  	
  	
  	
  <title>People</title>	
                                                       namespaces will be used
	
  	
  	
  	
  </collection>	
  
	
  	
  	
  	
  <collection	
  href="TitleScreenFormats">	
  
                                                                                                      to define the content
	
  	
  	
  	
  	
  	
  <title>TitleScreenFormats</title>	
  
	
  	
  	
  	
  </collection>	
  
	
  	
  	
  	
  <collection	
  href="Languages">	
  
	
  	
  	
  	
  	
  	
  <title>Languages</title>	
  
	
  	
  	
  	
  </collection>	
  
	
  	
  </workspace>	
  
</service>	
  



 This example is taken from Netflix’s online catalogue available at
 http://odata.netflix.com/v2/Catalog/	
  

©  2012 SAP AG. All rights reserved.                                                                                        11
An Example of an OData Service Document – 2/2

<service	
  xml:base="http://odata.netflix.com/v2/Catalog/”	
  
	
  	
  	
  	
  xmlns:atom="http://www.w3.org/2005/Atom"	
  xmlns="http://www.w3.org/2007/app”>	
  
	
  	
  <workspace>	
  
	
  	
  	
  	
  <title>Default</title>	
  
	
  	
  	
  	
  <collection	
  href="Genres">	
  
	
  	
  	
  	
  	
  	
  <title>Genres</title>	
  
                                                  The collection tag defines the relative
	
  	
  	
  	
  </collection>	
                   URL and title of an individual collection
	
  	
  	
  	
  <collection	
  href="Titles">	
  
	
  	
  	
  	
  	
  	
  <title>Titles</title>	
  
	
  	
  	
  	
  </collection>	
  
	
  	
  	
  	
  <collection	
  href="TitleAudioFormats">	
  
	
  	
  	
  	
  	
  	
  <title>TitleAudioFormats</title>	
  
	
  	
  	
  	
  </collection>	
  
	
  	
  	
  	
  <collection	
  href="TitleAwards">	
              The workspace tag defines which collections
	
  	
  	
  	
  	
  	
  <title>TitleAwards</title>	
  
	
  	
  	
  	
  </collection>	
  
                                                                  are provided by this OData Service
	
  	
  	
  	
  <collection	
  href="People">	
  
	
  	
  	
  	
  	
  	
  <title>People</title>	
  
	
  	
  	
  	
  </collection>	
  
	
  	
  	
  	
  <collection	
  href="TitleScreenFormats">	
  
	
  	
  	
  	
  	
  	
  <title>TitleScreenFormats</title>	
  
	
  	
  	
  	
  </collection>	
  
	
  	
  	
  	
  <collection	
  href="Languages">	
  
	
  	
  	
  	
  	
  	
  <title>Languages</title>	
  
	
  	
  	
  	
  </collection>	
  
	
  	
  </workspace>	
  
</service>	
  



 This example is taken from Netflix’s online catalogue available at
 http://odata.netflix.com/v2/Catalog/	
  

©  2012 SAP AG. All rights reserved.                                                                            12
Accessing an OData Collection – Construct the URL

Using the base URL defined in the service document’s <service> tag, we can
now construct the correct URL to access any collection listed in the workspace:

<service	
  xml:base="http://odata.netflix.com/v2/Catalog/”	
  
	
  	
  	
  	
  xmlns:atom="http://www.w3.org/2005/Atom"	
  xmlns="http://www.w3.org/2007/app”>	
  
	
  	
  <workspace>	
  
	
  	
  	
  	
  <title>Default</title>	
  
	
  	
  	
  	
  <collection	
  href="Genres">	
  
	
  	
  	
  	
  	
  	
  <title>Genres</title>	
  
	
  	
  	
  	
  </collection>	
  
	
  
	
  	
  	
  	
  ...	
  snip	
  ...	
  
	
  
	
  	
  </workspace>	
  
</service>	
  

 http://odata.netflix.com/v2/Catalog/Genres

When this URL is now issued, we will receive the contents of the “Genres”
collection.


©  2012 SAP AG. All rights reserved.                                                                  13
Accessing an OData Collection – A Structured Response

                                       In ABAP, this                                              Corresponds to a row
                                         data would                <feed>	
                        in an ABAP table
                                        be in a table


         1                              1                  1                      1               0..n


     <title>	
                         <id>	
           <updated>	
             <link>	
      <entry>	
  




          1                             1                  1                    1..n                1             0..1


      <title>	
                         <id>	
          <updated>	
             <link>	
     <category>	
        <content>	
  


                                                                                                                 1..n


                                                                                                               <properties>	
  
                                                                        Corresponds to a column
                                                                            in an ABAP table


©  2012 SAP AG. All rights reserved.                                                                                         14
Understanding OData XML – 1/4

<?xml	
  version="1.0"	
  encoding="iso-­‐8859-­‐1"	
  standalone="yes"?>	
  
<feed	
  xml:base="http://odata.netflix.com/v2/Catalog/"	
  
	
  	
  	
  	
  xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices”	
  
	
  	
  	
  	
  xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"	
  
	
  	
  	
  	
  xmlns="http://www.w3.org/2005/Atom">	
  
	
  	
  <title	
  type="text">Genres</title>	
  
	
  	
  <id>http://odata.netflix.com/v2/Catalog/Genres/</id>	
  
	
  	
  <updated>2011-­‐10-­‐17T15:25:10Z</updated>	
  
	
  	
  <link	
  rel="self"	
  title="Genres"	
  href="Genres"	
  />	
  
	
  	
  <entry>	
  
	
  	
  	
  	
  <id>http://odata.netflix.com/v2/Catalog/Genres('Action%20%26%20Adventure')</id>	
  
	
  	
  	
  	
  <title	
  type="text">Action	
  &amp;	
  Adventure</title>	
  
	
  	
  	
  	
  <updated>2011-­‐10-­‐17T15:25:10Z</updated>	
                                                     The <feed> element
	
  	
  	
  	
  <author>	
  
	
  	
  	
  	
  	
  	
  <name	
  />	
                                                                             defines a collection of
	
  	
  	
  	
  </author>	
  
	
  	
  	
  	
  <link	
  rel="edit"	
  title="Genre"	
  href="Genres('Action%20%26%20Adventure')"	
  />	
  
                                                                                                                  zero or more <entry>
	
  	
  	
  	
  <link	
  rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Titles”	
             elements
	
  	
  	
  	
  	
  	
  	
  	
  type="application/atom+xml;type=feed”	
  
	
  	
  	
  	
  	
  	
  	
  	
  title="Titles"	
  href="Genres('Action%20%26%20Adventure')/Titles"	
  />	
  
	
  	
  	
  	
  <category	
  term="Netflix.Catalog.v2.Genre”	
  
	
  	
  	
  	
  	
  	
  	
  	
  scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"	
  />	
  
	
  	
  	
  	
  <content	
  type="application/xml">	
  
	
  	
  	
  	
  	
  	
  <m:properties>	
  
	
  	
  	
  	
  	
  	
  	
  	
  <d:Name>Action	
  &amp;	
  Adventure</d:Name>	
  
	
  	
  	
  	
  	
  	
  </m:properties>	
  
	
  	
  	
  	
  </content>	
  
	
  	
  </entry>	
  
</feed>	
  


  This example is taken from http://odata.netflix.com/v2/Catalog/Genres	
  

©  2012 SAP AG. All rights reserved.                                                                                                   15
Understanding OData XML – 2/4

<?xml	
  version="1.0"	
  encoding="iso-­‐8859-­‐1"	
  standalone="yes"?>	
  
<feed	
  xml:base="http://odata.netflix.com/v2/Catalog/"	
  
	
  	
  	
  	
  xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices”	
  
	
  	
  	
  	
  xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"	
  
	
  	
  	
  	
  xmlns="http://www.w3.org/2005/Atom">	
  
	
  	
  <title	
  type="text">Genres</title>	
  
	
  	
  <id>http://odata.netflix.com/v2/Catalog/Genres/</id>	
  
	
  	
  <updated>2011-­‐10-­‐17T15:25:10Z</updated>	
  
	
  	
  <link	
  rel="self"	
  title="Genres"	
  href="Genres"	
  />	
  
	
  	
  <entry>	
  
	
  	
  	
  	
  <id>http://odata.netflix.com/v2/Catalog/Genres('Action%20%26%20Adventure')</id>	
  
	
  	
  	
  	
  <title	
  type="text">Action	
  &amp;	
  Adventure</title>	
  
	
  	
  	
  	
  <updated>2011-­‐10-­‐17T15:25:10Z</updated>	
  
	
  	
  	
  	
  <author>	
  
	
  	
  	
  	
  	
  	
  <name	
  />	
  
	
  	
  	
  	
  </author>	
  
	
  	
  	
  	
  <link	
  rel="edit"	
  title="Genre"	
  href="Genres('Action%20%26%20Adventure')"	
  />	
         The <entry> element
	
  	
  	
  	
  <link	
  rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Titles”	
  
	
  	
  	
  	
  	
  	
  	
  	
  type="application/atom+xml;type=feed”	
  
                                                                                                                  contains the data for one
	
  	
  	
  	
  	
  	
  	
  	
  title="Titles"	
  href="Genres('Action%20%26%20Adventure')/Titles"	
  />	
        member of the feed’s
	
  	
  	
  	
  <category	
  term="Netflix.Catalog.v2.Genre”	
  
	
  	
  	
  	
  	
  	
  	
  	
  scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"	
  />	
     collection
	
  	
  	
  	
  <content	
  type="application/xml">	
  
	
  	
  	
  	
  	
  	
  <m:properties>	
  
	
  	
  	
  	
  	
  	
  	
  	
  <d:Name>Action	
  &amp;	
  Adventure</d:Name>	
  
	
  	
  	
  	
  	
  	
  </m:properties>	
  
	
  	
  	
  	
  </content>	
  
	
  	
  </entry>	
  
</feed>	
  


  This example is taken from http://odata.netflix.com/v2/Catalog/Genres	
  

©  2012 SAP AG. All rights reserved.                                                                                                   16
Understanding OData XML – 3/4

<?xml	
  version="1.0"	
  encoding="iso-­‐8859-­‐1"	
  standalone="yes"?>	
  
<feed	
  xml:base="http://odata.netflix.com/v2/Catalog/"	
  
	
  	
  	
  	
  xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices”	
  
	
  	
  	
  	
  xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"	
  
	
  	
  	
  	
  xmlns="http://www.w3.org/2005/Atom">	
  
	
  	
  <title	
  type="text">Genres</title>	
  
	
  	
  <id>http://odata.netflix.com/v2/Catalog/Genres/</id>	
  
	
  	
  <updated>2011-­‐10-­‐17T15:25:10Z</updated>	
  
	
  	
  <link	
  rel="self"	
  title="Genres"	
  href="Genres"	
  />	
  
	
  	
  <entry>	
  
	
  	
  	
  	
  <id>http://odata.netflix.com/v2/Catalog/Genres('Action%20%26%20Adventure')</id>	
  
	
  	
  	
  	
  <title	
  type="text">Action	
  &amp;	
  Adventure</title>	
  
	
  	
  	
  	
  <updated>2011-­‐10-­‐17T15:25:10Z</updated>	
  
	
  	
  	
  	
  <author>	
  
	
  	
  	
  	
  	
  	
  <name	
  />	
  
	
  	
  	
  	
  </author>	
  
	
  	
  	
  	
  <link	
  rel="edit"	
  title="Genre"	
  href="Genres('Action%20%26%20Adventure')"	
  />	
  
	
  	
  	
  	
  <link	
  rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Titles”	
  
	
  	
  	
  	
  	
  	
  	
  	
  type="application/atom+xml;type=feed”	
  
	
  	
  	
  	
  	
  	
  	
  	
  title="Titles"	
  href="Genres('Action%20%26%20Adventure')/Titles"	
  />	
  
	
  	
  	
  	
  <category	
  term="Netflix.Catalog.v2.Genre”	
  
	
  	
  	
  	
  	
  	
  	
  	
  scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"	
  />	
  
	
  	
  	
  	
  <content	
  type="application/xml">	
  
	
  	
  	
  	
  	
  	
  <m:properties>	
  
                                                                      The <content> element contains
	
  	
  	
  	
  	
  	
  	
  	
  <d:Name>Action	
  &amp;	
  Adventure</d:Name>	
  
	
  	
  	
  	
  	
  	
  </m:properties>	
                             the actual business data
	
  	
  	
  	
  </content>	
  
	
  	
  </entry>	
  
</feed>	
  


  This example is taken from http://odata.netflix.com/v2/Catalog/Genres	
  

©  2012 SAP AG. All rights reserved.                                                                              17
Understanding OData XML – 4/4

<?xml	
  version="1.0"	
  encoding="iso-­‐8859-­‐1"	
  standalone="yes"?>	
  
<feed	
  xml:base="http://odata.netflix.com/v2/Catalog/"	
  
	
  	
  	
  	
  xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices”	
  
	
  	
  	
  	
  xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"	
  
	
  	
  	
  	
  xmlns="http://www.w3.org/2005/Atom">	
  
	
  	
  <title	
  type="text">Genres</title>	
  
	
  	
  <id>http://odata.netflix.com/v2/Catalog/Genres/</id>	
  
	
  	
  <updated>2011-­‐10-­‐17T15:25:10Z</updated>	
  
	
  	
  <link	
  rel="self"	
  title="Genres"	
  href="Genres"	
  />	
  
	
  	
  <entry>	
  
	
  	
  	
  	
  <id>http://odata.netflix.com/v2/Catalog/Genres('Action%20%26%20Adventure')</id>	
  
	
  	
  	
  	
  <title	
  type="text">Action	
  &amp;	
  Adventure</title>	
  
	
  	
  	
  	
  <updated>2011-­‐10-­‐17T15:25:10Z</updated>	
  
	
  	
  	
  	
  <author>	
  
	
  	
  	
  	
  	
  	
  <name	
  />	
  
	
  	
  	
  	
  </author>	
  
	
  	
  	
  	
  <link	
  rel="edit"	
  title="Genre"	
  href="Genres('Action%20%26%20Adventure')"	
  />	
  
	
  	
  	
  	
  <link	
  rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Titles”	
             The <link> elements point
	
  	
  	
  	
  	
  	
  	
  	
  type="application/atom+xml;type=feed”	
  
	
  	
  	
  	
  	
  	
  	
  	
  title="Titles"	
  href="Genres('Action%20%26%20Adventure')/Titles"	
  />	
        to related business data
	
  	
  	
  	
  <category	
  term="Netflix.Catalog.v2.Genre”	
  
	
  	
  	
  	
  	
  	
  	
  	
  scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"	
  />	
  
	
  	
  	
  	
  <content	
  type="application/xml">	
  
	
  	
  	
  	
  	
  	
  <m:properties>	
  
	
  	
  	
  	
  	
  	
  	
  	
  <d:Name>Action	
  &amp;	
  Adventure</d:Name>	
  
	
  	
  	
  	
  	
  	
  </m:properties>	
  
	
  	
  	
  	
  </content>	
  
	
  	
  </entry>	
  
</feed>	
  


  This example is taken from http://odata.netflix.com/v2/Catalog/Genres	
  

©  2012 SAP AG. All rights reserved.                                                                                                    18
Agenda

u    Atom and OData – Building Towards a Business Interface
u    Gateway – OData for the Enterprise
u    Using Gateway – OData in Practice (Read Only)
         u    The QUERY operation – retrieving all or part of a collection
         u    The READ operation – retrieving a single entry from a collection
         u    Understanding the XML returned by the QUERY and READ operations
         u    Mapping OData properties to Atom elements




 ©  2012 SAP AG. All rights reserved.                                             19
Obtaining OData Metadata

In order to consume an OData service, you should retrieve the metadata that
describes that service. This is done by adding the suffix $metadata to the Service
Document URL. (OData metadata is only available in XML format, not JSON)
E.G. http://odata.netflix.com/v2/Catalog/$metadata
This will now return an Entity Data Model (edmx) XML description of the service:
(There is currently no standard for representing EDMs in JSON; therefore, the metadata description of an OData service is only
available in XML format)

<edmx:Edmx	
  Version="1.0">	
  
	
  	
  <edmx:DataServices	
  m:DataServiceVersion="1.0">	
  
	
  	
  	
  	
  <Schema	
  Namespace="Netflix.Catalog.v2">	
  
	
  	
  	
  	
  	
  	
  <EntityType	
  Name="Genre">	
  
	
  	
  	
  	
  	
  	
  	
  	
  <Key>	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  <PropertyRef	
  Name="Name"/>	
  
	
  	
  	
  	
  	
  	
  	
  	
  </Key>	
  
	
  	
  	
  	
  	
  	
  	
  	
  <Property	
  Name="Name"	
  Type="Edm.String"	
  Nullable="false"	
  MaxLength="128"	
  Unicode="true”	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  FixedLength="false"	
  m:FC_TargetPath="SyndicationTitle"	
  m:FC_ContentKind="text"	
  m:FC_KeepInContent="True"/>	
  
	
  	
  	
  	
  	
  	
  	
  	
  <NavigationProperty	
  Name="Titles"	
  Relationship="Netflix.Catalog.v2.Genre_Titles”	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  FromRole="Genre_Titles_Source"	
  ToRole="Genre_Titles_Target"/>	
  
	
  	
  	
  	
  	
  	
  </EntityType>	
  
	
  	
  	
  	
  	
  	
  <EntityType	
  Name="Title"	
  m:HasStream="true">	
  
	
  	
  	
  	
  	
  	
  	
  	
  <Key>	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  <PropertyRef	
  Name="Id"/>	
  
	
  	
  	
  	
  	
  	
  	
  	
  </Key>	
  
	
  
...	
  snip	
  ...	
  



 ©  2012 SAP AG. All rights reserved.                                                                                                                                20
SAP Extensions To OData Metadata

The standard OData metadata is not able to fully describe all the information held
in the ABAP Data Dictionary; therefore, the Gateway server will send extra
metadata values identified by the sap: namespace prefix.
<EntityType	
  Name="Booking"	
  sap:content-­‐version="1">	
  
	
  	
  <Key>	
  
	
  	
  	
  	
  <PropertyRef	
  Name="AirlineId"/>	
  
	
  	
  	
  	
  <PropertyRef	
  Name="ConnectionNo"/>	
  
	
  	
  	
  	
  <PropertyRef	
  Name="FlightDate"/>	
  
	
  	
  	
  	
  <PropertyRef	
  Name="BookingId"/>	
  
	
  	
  </Key>	
  
	
  	
  <Property	
  Name="AirlineId”	
  	
  	
  	
  Type="Edm.String”	
  	
  	
  Nullable="false"	
  MaxLength="3”	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  sap:label="Airline"	
  sap:filterable="false"/>	
  
	
  	
  <Property	
  Name="ConnectionNo"	
  Type="Edm.String"	
  	
  	
  Nullable="false"	
  MaxLength="4”	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  sap:label="Flight	
  Number"	
  sap:filterable="false"/>	
  
	
  	
  <Property	
  Name="FlightDate"	
  	
  	
  Type="Edm.DateTime"	
  Nullable="false"	
  Precision="10”	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  sap:label="Date"	
  sap:filterable="false"/>	
  
	
  	
  <Property	
  Name="BookingId"	
  	
  	
  	
  Type="Edm.String"	
  	
  	
  Nullable="false"	
  MaxLength="8”	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  sap:label="Booking	
  number"	
  sap:filterable="false"/>	
  
	
  	
  <Property	
  Name="CustomerNo"	
  	
  	
  Type="Edm.String”	
  	
  	
  MaxLength="8”	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  sap:label="Customer	
  Number"	
  sap:filterable="false"/>	
  
	
  	
  <Property	
  Name="CustomerName”	
  Type="Edm.String"	
  	
  	
  MaxLength="25”	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  sap:label="Passenger	
  Name"	
  sap:filterable="false"	
  m:FC_TargetPath="SyndicationAuthorName”	
  />	
  
	
  	
  <Property	
  Name="Price"	
  	
  	
  	
  	
  	
  	
  	
  Type="Edm.Decimal"	
  	
  Precision="20"	
  Scale="2”	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  sap:label="Airfare"	
  sap:filterable="false"/>	
  
	
  	
  <Property	
  Name="CurrencyCode"	
  Type="Edm.String"	
  	
  	
  MaxLength="5”	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  sap:label="Airline	
  Currency"	
  sap:filterable="false"	
  sap:semantics="currency-­‐code"/>	
  
	
  	
  <Property	
  Name="BookingDate”	
  	
  Type="Edm.DateTime"	
  Precision="10”	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  sap:label="Booking	
  date"	
  sap:filterable="false”/>	
  
	
  
...	
  snip	
  ...	
  


©  2012 SAP AG. All rights reserved.                                                                                                                           21
Agenda

u    Atom and OData – Building Towards a Business Interface
u    Gateway – OData for the Enterprise
u    Using Gateway – OData in Practice (Read Only)
         u    The QUERY operation – retrieving all or part of a collection
         u    The READ operation – retrieving a single entry from a collection
         u    Understanding the XML returned by the QUERY and READ operations
         u    Mapping OData properties to Atom elements




 ©  2012 SAP AG. All rights reserved.                                             22
Agenda

u    Atom and OData – Building Towards a Business Interface
u    Gateway – OData for the Enterprise
u    Using Gateway – OData in Practice (Read Only)
         u    The QUERY operation – retrieving all or part of a collection
         u    The READ operation – retrieving a single entry from a collection
         u    Understanding the XML returned by the QUERY and READ operations
         u    Mapping OData properties to Atom elements




 ©  2012 SAP AG. All rights reserved.                                             23
Entity Data Model – Overview

In the following examples and exercises, we will be using the data model shown
below:




More information will be given about the details of this data model in later chapters.

©  2012 SAP AG. All rights reserved.                                                     24
Retrieving a Collection – ReadEntitySet Operation 1/3

To start with, we will cover the simplest two operations that can be performed using
OData: ReadEntitySet and ReadEntity (also referred to as QUERY and READ).
ReadEntitySet (QUERY)                      : Returns 0..n entries from a collection
ReadEntity (READ)                          : Returns 0..1 entries from a collection
Both operations are read-only and therefore use the HTTP GET method.



                                REST Operation                     HTTP Method
                                Create a resource                  POST
                                Retrieve one or more resources     GET
                                Update a resource                  PUT
                                Delete a resource                  DELETE




©  2012 SAP AG. All rights reserved.                                                  25
Retrieving a Collection – ReadEntitySet Operation 2/3

To start running a Gateway Service, you must know the service’s base URL. This
value is generated when the Gateway Service is first created.
The URL for an entire collection is formed by taking the URL found in the Gateway
Service’s xml:base parameter and appending to it the value of the href parameter
for the required collection.

<app:service	
  xml:base="http://mysapgateway.com/sap/opu/odata/sap/FlightInformation/">	
  
	
  
together with
	
  
<app:collection	
  href="Airports"	
  sap:content-­‐version="1">	
  


Gives http://mysapgateway.com/sap/opu/odata/sap/FlightInformation/Airports	
  

Since we need to use the HTTP GET method, this URL can be issued directly from
the browser’s address line.	
  



©  2012 SAP AG. All rights reserved.                                                      26
Retrieving a Collection – ReadEntitySet Operation 3/3

Issuing this URL from the browser’s address line will cause the Gateway server to
return an OData XML message containing the requested collection.




©  2012 SAP AG. All rights reserved.                                                27
Retrieving a Partial Collection – Filtering

If a collection has a high number of entries, then you can filter the <feed> contents
by using the $filter query string parameter:

Assuming a base URL of http://mysapgateway.com/sap/opu/odata/sap/FlightInformation/	
  
	
  
Then appending Airports?$filter=IATACode	
  eq	
  'FRA' will filter out all airports
except Frankfurt.
	
  
IMPORTANT!
1.  You must implement the ABAP coding that responds to this parameter
2.  A space character (or %20) must be included on either side of the operator in
    the $filter condition.
3.  If the property value being filtered is non-numeric, then it must be enclosed
    within single quotes.


For more information on $filter, see:
http://www.odata.org/developers/protocols/uri-­‐conventions#FilterSystemQueryOptions	
  
Please note, SAP NetWeaver Gateway does not support all $filter options

  ©  2012 SAP AG. All rights reserved.                                                     28
Retrieving a Partial Collection – Paging

If a collection has a high number of entries, then you can use the $top and $skip
parameters together to implement paging.

Individually, Airports?$top=5 would reduce the <feed> down to the first 5 entries.

And Airports?$skip=5 would omit the first 5 entries from the <feed>.	
  

Paging is achieved by setting $top to the number of entries per page, and then
incrementing $skip by this number every time the next page is required.

Assuming 10 entries per page, then to:
    View the first page   : Airports?$top=10	
  
    View the second page : Airports?$skip=10&$top=10	
  
    View the third page   : Airports?$skip=20&$top=10	
  
etc.

For more information on $top, and $skip, see:
http://www.odata.org/developers/protocols/uri-­‐conventions#TopSystemQueryOption and
following.


©  2012 SAP AG. All rights reserved.                                                   29
Agenda

u    Atom and OData – Building Towards a Business Interface
u    Gateway – OData for the Enterprise
u    Using Gateway – OData in Practice (Read Only)
         u    The QUERY operation – retrieving all or part of a collection
         u    The READ operation – retrieving a single entry from a collection
         u    Understanding the XML returned by the QUERY and READ operations
         u    Mapping OData properties to Atom elements




 ©  2012 SAP AG. All rights reserved.                                             30
Retrieving a Single Entry – ReadEntity Operation 1/2

Below is one entry from the Airports collection in the FlightInformation
service.
Notice that each <entry> element contains one or more <link> elements.
<entry>	
  
	
  
	
  	
  ...	
  snip	
  ...	
  
	
  
	
  	
  <link	
  href="Airports('FCO')"	
  ...	
  snip	
  .../>	
  
	
  	
  <link	
  href="Airports('FCO')/AirportsTo”	
  ...	
  snip	
  ...	
  />	
  
	
  	
  <link	
  href="Airports('FCO')/DepartingFlights”	
  ...	
  snip	
  ...	
  />	
  
	
  	
  <title>ROME	
  -­‐	
  FCO</title>	
  
	
  	
  <updated>2011-­‐10-­‐19T08:38:00Z</updated>	
  
</entry>	
  



The href parameter of the first <link> element contains a self-reference to the
current <entry>	
  



©  2012 SAP AG. All rights reserved.                                                       31
Retrieving a Single Entry – ReadEntity Operation 2/2

The first <link> element is always a self-reference. It contains the relative URL
for reading the current entry from the collection.
<link	
  href="Airports('FCO')"	
  ...	
  snip	
  .../>	
  

         IMPORTANT: The conventional query string syntax is not used here!
Instead, the collection name is immediately followed by a comma separated list of
name/value pairs, all enclosed within parentheses. This is known as the “Key
Predicate”.

                             CollectionName




This non-standard URL syntax is needed so that the OData server can distinguish
a READ operation (0..1 entries) from a QUERY operation (0..n entries)



 ©  2012 SAP AG. All rights reserved.                                               32
Agenda

u    Atom and OData – Building Towards a Business Interface
u    Gateway – OData for the Enterprise
u    Using Gateway – OData in Practice (Read Only)
         u    The QUERY operation – retrieving all or part of a collection
         u    The READ operation – retrieving a single entry from a collection
         u    Understanding the XML returned by the QUERY and READ operations
         u    Mapping OData properties to Atom elements




 ©  2012 SAP AG. All rights reserved.                                             33
XML Returned by ReadEntitySet and ReadEntity – 1/2

A ReadEntitySet operation will return zero or more entries; therefore, the OData
XML will always be contained within an <feed> element – even if the filter options
result in only one entry being returned.




                                       Zero or more
                                         <entry>
                                        elements




It is perfectly valid for a ReadEntitySet operation to return zero <entry> elements.




©  2012 SAP AG. All rights reserved.                                                   34
XML Returned by ReadEntitySet and ReadEntity – 2/2

A ReadEntity operation will return zero or one entry. Therefore the OData XML will
never be contained within an <feed> element.
Instead, a single <entry> element will be returned.




©  2012 SAP AG. All rights reserved.                                             35
Agenda

u    Atom and OData – Building Towards a Business Interface
u    Gateway – OData for the Enterprise
u    Using Gateway – OData in Practice (Read Only)
         u    The QUERY operation – retrieving all or part of a collection
         u    The READ operation – retrieving a single entry from a collection
         u    Understanding the XML returned by the QUERY and READ operations
         u    Mapping OData properties to Atom elements




 ©  2012 SAP AG. All rights reserved.                                             36
Standard ATOM Elements – 1/2

Within an <entry> element, there is always an <content> element. This element
contains zero or more OData properties.
However, since OData is based on Atom, there are elements outside the
<content> element that are also significant.




©  2012 SAP AG. All rights reserved.                                            37
Standard ATOM Elements – 2/2

These Atom elements are:
<author>, (which may itself contain <email>, <name> and <uri>), <published>,
<rights>, <summary>, and <title>.
For example:
<author>	
  
	
  	
  <name>Siegfried	
  Mechler</name>	
  
</author>	
  
	
  
<title	
  type="text">	
  
	
  	
  Booking	
  for	
  Siegfried	
  Mechler	
  on	
  flight	
  AA0017	
  on	
  20111207	
  
</title>	
  


It is possible to map OData properties into these standard Atom elements. This is
useful if you wish to display an OData message using an Atom Feed parser such
as a browser.

©  2012 SAP AG. All rights reserved.                                                             38
Mapping OData Properties to ATOM Elements – 1/2

If the coding in your Gateway Service does not explicitly map any OData properties
to the standard Atom elements, then the Gateway runtime will automatically
populate the <title> field with a default value.




                                                    Default value for the
                                                     <title> element




©  2012 SAP AG. All rights reserved.                                             39
Mapping OData Properties to ATOM Elements – 2/2

When writing the coding for a Gateway Service, you can map an OData property to
an Atom element. Here the <title> element has been supplied with data from an
OData property.




                                          The value from an OData
                                       property has now been mapped
                                           to the <title> element




©  2012 SAP AG. All rights reserved.                                          40
Summary



                               You should now be able to
                               Ÿ  The architecture of the Atom and OData protocols
                               Ÿ  How SAP NetWeaver Gateway makes use of OData
                               Ÿ  How to issue read-only OData requests from your browser




©  2012 SAP AG. All rights reserved.                                                         41
APPENDIX

u    Differences Between Atom and OData Terminology
u    Displaying Atom XML in a Browser




©  2012 SAP AG. All rights reserved.                   42
APPENDIX

u    Differences Between Atom and OData Terminology
u    Displaying Atom XML in a Browser




©  2012 SAP AG. All rights reserved.                   43
Atom and OData Terminology

OData has defined some terminology that differs from the Atom terminology, but in
fact refers to the same things.

                                       Atom    OData
                                       Feed    Collection / EntitySet
                                       Entry   Entity


The terms Entity and EntitySet will appear when using the ABAP OData API but
are interchangeable with the Atom terms Entry and Collection.




©  2012 SAP AG. All rights reserved.                                            44
APPENDIX

u    Differences Between Atom and OData Terminology
u    Displaying Atom XML in a Browser




©  2012 SAP AG. All rights reserved.                   45
Displaying Atom XML in your Browser

You may find that your browser does not display Atom XML in a formatted manner.
This is due to the MIME type used by the Gateway server.


                                           The Gateway server returns XML
                                           with a MIME type of
                                           application/atom+xml	
  
                                           Most modern browsers will interpret
                                           this as an Atom feed and format the
                                           results in the manner shown here.
                                           If you want to see the indented XML,
                                           then you add the query string
                                           parameter sap-­‐ds-­‐debug=true.
                                           This causes the Gateway server to
                                           format the XML and present it as an
                                           HTML page.

©  2012 SAP AG. All rights reserved.                                             46
© 2012 SAP AG. All rights reserved


No part of this publication may be reproduced or transmitted in any form or for any purpose   Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal
without the express permission of SAP AG. The information contained herein may be             Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services
changed without prior notice.                                                                 mentioned herein as well as their respective logos are trademarks or registered trademarks
                                                                                              of Business Objects Software Ltd. Business Objects is an SAP company.
Some software products marketed by SAP AG and its distributors contain proprietary
software components of other software vendors.                                                Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere, and other Sybase
Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft     products and services mentioned herein as well as their respective logos are trademarks or
                                                                                              registered trademarks of Sybase, Inc. Sybase is an SAP company.
Corporation.
                                                                                              All other product and service names mentioned are the trademarks of their respective
IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x,
                                                                                              companies. Data contained in this document serves informational purposes only. National
System z, System z10, System z9, z10, z9, iSeries, pSeries, xSeries, zSeries, eServer, z/
                                                                                              product specifications may vary.
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,                         The information in this document is proprietary to SAP. No part of this document may be
OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS, HACMP,                     reproduced, copied, or transmitted in any form or for any purpose without the express prior
RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX, Intelligent        written permission of SAP AG.
Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of   This document is a preliminary version and not subject to your license agreement or any
IBM Corporation.                                                                              other agreement with SAP. This document contains only intended strategies, developments,
Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.          and functionalities of the SAP® product and is not intended to be binding upon SAP to any
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered    particular course of business, product strategy, and/or development. Please note that this
                                                                                              document is subject to change and may be changed by SAP at any time without notice.
trademarks of Adobe Systems Incorporated in the United States and/or other countries.
                                                                                              SAP assumes no responsibility for errors or omissions in this document. SAP does not
Oracle is a registered trademark of Oracle Corporation.
                                                                                              warrant the accuracy or completeness of the information, text, graphics, links, or other items
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.                   contained within this material. This document is provided without a warranty of any kind,
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are          either express or implied, including but not limited to the implied warranties of
trademarks or registered trademarks of Citrix Systems, Inc.                                   merchantability, fitness for a particular purpose, or non-infringement.
HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World               SAP shall have no liability for damages of any kind including without limitation direct, special,
Wide Web Consortium, Massachusetts Institute of Technology.                                   indirect, or consequential damages that may result from the use of these materials. This
                                                                                              limitation shall not apply in cases of intent or gross negligence.
Java is a registered trademark of Sun Microsystems, Inc.
                                                                                              The statutory liability for personal injury and defective products is not affected. SAP has no
JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for        control over the information that you may access through the use of hot links contained in
technology invented and implemented by Netscape.                                              these materials and does not endorse your use of third-party Web pages nor provide any
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP BusinessObjects Explorer,           warranty whatsoever relating to third-party Web pages.
StreamWork, and other SAP products and services mentioned herein as well as their
respective logos are trademarks or registered trademarks of SAP AG in Germany and other
countries.




 ©  2012 SAP AG. All rights reserved.                                                                                                                                                     47

More Related Content

What's hot (20)

PDF
SAP ODATA Overview & Guidelines
Ashish Saxena
 
PPTX
SAP ALE Idoc
Jugul Crasta
 
PPT
ABAP Programming Overview
sapdocs. info
 
DOC
Badi document
hamisha_malik
 
PPTX
Top 10 sap abap faqs-www.bigclasses.com
bigclasses.com
 
ODP
Introduction to OData
Mindfire Solutions
 
PPTX
Odata
Monalisa Patel
 
PPT
BATCH DATA COMMUNICATION
Kranthi Kumar
 
PDF
Enhancement framework the new way to enhance your abap systems
Kranthi Kumar
 
PDF
Beginner's Guide: Programming with ABAP on HANA
Ashish Saxena
 
PPTX
Sap abap
SVRTechnologies
 
PPTX
OData: A Standard API for Data Access
Pat Patterson
 
PPTX
Sap abap
Jugul Crasta
 
PPTX
Oops abap fundamental
biswajit2015
 
PDF
22827361 ab initio-fa-qs
Capgemini
 
PPT
Using Java to implement SOAP Web Services: JAX-WS
Katrien Verbert
 
PPTX
Introduction to Apache Hive(Big Data, Final Seminar)
Takrim Ul Islam Laskar
 
PDF
Infoobject
Abhijit Das
 
PDF
Technical Overview of CDS View – SAP HANA Part I
Ashish Saxena
 
PPTX
OData Fundamental
Kamrul Hasan
 
SAP ODATA Overview & Guidelines
Ashish Saxena
 
SAP ALE Idoc
Jugul Crasta
 
ABAP Programming Overview
sapdocs. info
 
Badi document
hamisha_malik
 
Top 10 sap abap faqs-www.bigclasses.com
bigclasses.com
 
Introduction to OData
Mindfire Solutions
 
BATCH DATA COMMUNICATION
Kranthi Kumar
 
Enhancement framework the new way to enhance your abap systems
Kranthi Kumar
 
Beginner's Guide: Programming with ABAP on HANA
Ashish Saxena
 
Sap abap
SVRTechnologies
 
OData: A Standard API for Data Access
Pat Patterson
 
Sap abap
Jugul Crasta
 
Oops abap fundamental
biswajit2015
 
22827361 ab initio-fa-qs
Capgemini
 
Using Java to implement SOAP Web Services: JAX-WS
Katrien Verbert
 
Introduction to Apache Hive(Big Data, Final Seminar)
Takrim Ul Islam Laskar
 
Infoobject
Abhijit Das
 
Technical Overview of CDS View – SAP HANA Part I
Ashish Saxena
 
OData Fundamental
Kamrul Hasan
 

Viewers also liked (8)

PDF
SAP NetWeaver Gateway - Introduction
SAP PartnerEdge program for Application Development
 
PDF
OData, Open Data Protocol. A brief introduction
Eugenio Lentini
 
PPTX
Practical OData
Vagif Abilov
 
PPTX
OData Introduction and Impact on API Design (Webcast)
Apigee | Google Cloud
 
PDF
JavaScript for ABAP Programmers - 4/7 Scope
Chris Whealy
 
DOCX
Sap abap on hana
WebTrackker Technology
 
PPTX
SAP HANA ABAP TRAINING | SAP HANA ABAP ONLINE COURSE TRAINING - GOT
Global Online Trainings
 
PDF
The S/4 HANA Programing Paradigm
msg systems Romania
 
SAP NetWeaver Gateway - Introduction
SAP PartnerEdge program for Application Development
 
OData, Open Data Protocol. A brief introduction
Eugenio Lentini
 
Practical OData
Vagif Abilov
 
OData Introduction and Impact on API Design (Webcast)
Apigee | Google Cloud
 
JavaScript for ABAP Programmers - 4/7 Scope
Chris Whealy
 
Sap abap on hana
WebTrackker Technology
 
SAP HANA ABAP TRAINING | SAP HANA ABAP ONLINE COURSE TRAINING - GOT
Global Online Trainings
 
The S/4 HANA Programing Paradigm
msg systems Romania
 
Ad

Similar to NetWeaver Gateway- Introduction to OData (20)

PPTX
Introduction to OData and SAP NetWeaver Gateway.pptx
Richard314186
 
PDF
Document_format_for_OData_In_A_Nutshell.pdf
davidjpeace
 
PPTX
SAP FIORI COEP Pune - pavan golesar (ppt)
Pavan Golesar
 
PPTX
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
Pat Patterson
 
PPTX
Mike Taulty OData (NxtGen User Group UK)
ukdpe
 
PPTX
OData and SharePoint
Sanjay Patel
 
PDF
DAY1- DAY2Netweaver gateway
Gaurav Ahluwalia
 
PDF
DAY1- DAY2Netweaver gateway
Gaurav Ahluwalia
 
PDF
DAY1- DAY2Netweaver gateway
Gaurav Ahluwalia
 
PPTX
Introduction to o data
Venkatesh Narayanan
 
PPTX
Breaking down data silos with the open data protocol
Woodruff Solutions LLC
 
PDF
Sap net weaver gateway and o data - sap netweaver gateway - sap library
Nagendra Babu
 
PDF
SAP REST Summit 2009 - Atom At Work
Juergen Schmerder
 
PDF
WCF Data Services - Office Business Application &amp; iPhone
Andri Yadi
 
PDF
Paul Fremantle Restful SOA Registry
deimos
 
PPTX
Gaining the Knowledge of the Open Data Protocol (OData)
Woodruff Solutions LLC
 
PPTX
Gaining the Knowledge of the Open Data Protocol (OData)
Woodruff Solutions LLC
 
PPTX
Consuming Data From Many Platforms: The Benefits of OData - St. Louis Day of ...
Eric D. Boyd
 
PDF
REST - What's It All About? (SAP TechEd 2012, CD110)
Sascha Wenninger
 
PPTX
Building RESTfull Data Services with WebAPI
Gert Drapers
 
Introduction to OData and SAP NetWeaver Gateway.pptx
Richard314186
 
Document_format_for_OData_In_A_Nutshell.pdf
davidjpeace
 
SAP FIORI COEP Pune - pavan golesar (ppt)
Pavan Golesar
 
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
Pat Patterson
 
Mike Taulty OData (NxtGen User Group UK)
ukdpe
 
OData and SharePoint
Sanjay Patel
 
DAY1- DAY2Netweaver gateway
Gaurav Ahluwalia
 
DAY1- DAY2Netweaver gateway
Gaurav Ahluwalia
 
DAY1- DAY2Netweaver gateway
Gaurav Ahluwalia
 
Introduction to o data
Venkatesh Narayanan
 
Breaking down data silos with the open data protocol
Woodruff Solutions LLC
 
Sap net weaver gateway and o data - sap netweaver gateway - sap library
Nagendra Babu
 
SAP REST Summit 2009 - Atom At Work
Juergen Schmerder
 
WCF Data Services - Office Business Application &amp; iPhone
Andri Yadi
 
Paul Fremantle Restful SOA Registry
deimos
 
Gaining the Knowledge of the Open Data Protocol (OData)
Woodruff Solutions LLC
 
Gaining the Knowledge of the Open Data Protocol (OData)
Woodruff Solutions LLC
 
Consuming Data From Many Platforms: The Benefits of OData - St. Louis Day of ...
Eric D. Boyd
 
REST - What's It All About? (SAP TechEd 2012, CD110)
Sascha Wenninger
 
Building RESTfull Data Services with WebAPI
Gert Drapers
 
Ad

More from SAP PartnerEdge program for Application Development (20)

PDF
SAP HANA Cloud Platform Expert Session - SAP HANA Cloud Platform Analytics
SAP PartnerEdge program for Application Development
 
PDF
SUSE Technical Webinar – Get started with creating Lumira CVOM extensions -- ...
SAP PartnerEdge program for Application Development
 
PDF
SUSE Technical Webinar – Get started with creating Design Studio extensions -...
SAP PartnerEdge program for Application Development
 
PDF
SUSE Technical Webinar: Build HANA Apps in the Framework of the SAP and SUSE ...
SAP PartnerEdge program for Application Development
 
PDF
SUSE Technical Webinar: Developing Fiori & GWPAM Apps on HANA (SAP and SUSE C...
SAP PartnerEdge program for Application Development
 
PDF
SUSE Technical Webinar: Developing Fiori & GWPAM Apps on HANA (SAP and SUSE C...
SAP PartnerEdge program for Application Development
 
PDF
SUSE Technical Webinar: Build B1 apps in the Framework of the SAP and SUSE Ca...
SAP PartnerEdge program for Application Development
 
PDF
Google Technical Webinar - Building Mashups with Google Apps and SAP, using S...
SAP PartnerEdge program for Application Development
 
PDF
Google Technical Webinar - Building Mashups with Google Apps and SAP, using S...
SAP PartnerEdge program for Application Development
 
PDF
SUSE Technical Webinar: Introduction to Business Intelligence - the SAP and S...
SAP PartnerEdge program for Application Development
 
PDF
SUSE Technical Webinar: Build Cloud Apps with SAP HANA Cloud Platform
SAP PartnerEdge program for Application Development
 
PDF
Partner with SAP to Develop Mobile apps and capture the Mobile Market Opportu...
SAP PartnerEdge program for Application Development
 
PDF
Microsoft Technical Webinar: SAP Mobile Platform for Windows 8 and Windows Ph...
SAP PartnerEdge program for Application Development
 
PDF
Microsoft Technical Webinar - New devices for Windows 8 and Windows Phone 8, ...
SAP PartnerEdge program for Application Development
 
PDF
Autodesk Technical Webinar: SAP Business One
SAP PartnerEdge program for Application Development
 
PDF
Microsoft Technical Webinar: Doing more with MS Office, SharePoint and Visual...
SAP PartnerEdge program for Application Development
 
PDF
Microsoft Technical Webinar: UX/UI Design for Windows 8 & Windows Phone 8 - S...
SAP PartnerEdge program for Application Development
 
PDF
Microsoft Technical Webinar: UX/UI Design for Windows 8 & Windows Phone 8 - P...
SAP PartnerEdge program for Application Development
 
PDF
Autodesk Technical Webinar: SAP HANA in-memory database
SAP PartnerEdge program for Application Development
 
SAP HANA Cloud Platform Expert Session - SAP HANA Cloud Platform Analytics
SAP PartnerEdge program for Application Development
 
SUSE Technical Webinar – Get started with creating Lumira CVOM extensions -- ...
SAP PartnerEdge program for Application Development
 
SUSE Technical Webinar – Get started with creating Design Studio extensions -...
SAP PartnerEdge program for Application Development
 
SUSE Technical Webinar: Build HANA Apps in the Framework of the SAP and SUSE ...
SAP PartnerEdge program for Application Development
 
SUSE Technical Webinar: Developing Fiori & GWPAM Apps on HANA (SAP and SUSE C...
SAP PartnerEdge program for Application Development
 
SUSE Technical Webinar: Developing Fiori & GWPAM Apps on HANA (SAP and SUSE C...
SAP PartnerEdge program for Application Development
 
SUSE Technical Webinar: Build B1 apps in the Framework of the SAP and SUSE Ca...
SAP PartnerEdge program for Application Development
 
Google Technical Webinar - Building Mashups with Google Apps and SAP, using S...
SAP PartnerEdge program for Application Development
 
Google Technical Webinar - Building Mashups with Google Apps and SAP, using S...
SAP PartnerEdge program for Application Development
 
SUSE Technical Webinar: Introduction to Business Intelligence - the SAP and S...
SAP PartnerEdge program for Application Development
 
SUSE Technical Webinar: Build Cloud Apps with SAP HANA Cloud Platform
SAP PartnerEdge program for Application Development
 
Partner with SAP to Develop Mobile apps and capture the Mobile Market Opportu...
SAP PartnerEdge program for Application Development
 
Microsoft Technical Webinar: SAP Mobile Platform for Windows 8 and Windows Ph...
SAP PartnerEdge program for Application Development
 
Microsoft Technical Webinar - New devices for Windows 8 and Windows Phone 8, ...
SAP PartnerEdge program for Application Development
 
Autodesk Technical Webinar: SAP Business One
SAP PartnerEdge program for Application Development
 
Microsoft Technical Webinar: Doing more with MS Office, SharePoint and Visual...
SAP PartnerEdge program for Application Development
 
Microsoft Technical Webinar: UX/UI Design for Windows 8 & Windows Phone 8 - S...
SAP PartnerEdge program for Application Development
 
Microsoft Technical Webinar: UX/UI Design for Windows 8 & Windows Phone 8 - P...
SAP PartnerEdge program for Application Development
 
Autodesk Technical Webinar: SAP HANA in-memory database
SAP PartnerEdge program for Application Development
 

Recently uploaded (20)

PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 

NetWeaver Gateway- Introduction to OData

  • 1. GW100 SAP NetWeaver Gateway Introduction to OData May, 2012 INTE RNA L
  • 2. Objectives At the end of this chapter, you will understand: Ÿ  The architecture of the Atom and OData protocols Ÿ  How SAP NetWeaver Gateway makes use of OData Ÿ  How to issue read-only OData requests from your browser ©  2012 SAP AG. All rights reserved. 2
  • 3. Agenda u  Atom and OData – Building Towards a Business Interface u  Gateway – OData for the Enterprise u  Using Gateway – OData in Practice (Read Only) u  The QUERY operation – retrieving all or part of a collection u  The READ operation – retrieving a single entry from a collection u  Understanding the XML returned by the QUERY and READ operations u  Mapping OData properties to Atom elements ©  2012 SAP AG. All rights reserved. 3
  • 4. Agenda u  Atom and OData – Building Towards a Business Interface u  Gateway – OData for the Enterprise u  Using Gateway – OData in Practice (Read Only) u  The QUERY operation – retrieving all or part of a collection u  The READ operation – retrieving a single entry from a collection u  Understanding the XML returned by the QUERY and READ operations u  Mapping OData properties to Atom elements ©  2012 SAP AG. All rights reserved. 4
  • 5. What is the Open Data Protocol (OData)? OData is a Microsoft developed extension to the Atom Publishing and Atom Syndication standards, which in turn, are based on XML and HTTP(S). SAP Annotations It was designed to provide a standardised OData implementation of a RESTful API. In doing so, it offers database-like access to server-side Atom Publishing resources. Hence, OData has been described as: Atom Syndication “ODBC for the Web” It can be used freely without the need for a license XML or JSON or contract. HTTP(S) OData is also extensible. This allows SAP to supplement the data types used by OData with extra information from the ABAP Data Dictionary. ©  2012 SAP AG. All rights reserved. 5
  • 6. What is Atom? Atom is pair of standards Atom Syndication Format SAP Annotations -  An XML based description of the documents supplied by a website OData -  These descriptions are typically consumed by content syndication websites Atom Publishing -  In Atom terminology, a collection of documents is known as a “Feed” Atom Syndication -  A Feed is compose of zero or more “Entries” XML Atom Publishing Format -  An HTTP based protocol that allows the HTTP manipulation of Atom Syndication documents Atom Syndication and Atom Publishing are only partially RESTful protocols. ©  2012 SAP AG. All rights reserved. 6
  • 7. What Does OData Add to Atom? The Atom Publishing Format does not specify how data should be encoded within a Feed; SAP Annotations therefore, it fails to be fully RESTful because its messages are not self-describing. OData OData extends Atom by providing a metadata description of the message. Atom Publishing OData provides definitions for: Atom Syndication -  Simple Types -  Complex Types XML -  Associations between entries -  Navigation Paths between entries HTTP -  Custom behaviour beyond the standard CRUD operations ©  2012 SAP AG. All rights reserved. 7
  • 8. Output Formats Supported by OData OData supports the use of either XML or JSON format messages. {  "d":{      "__count":”2",      "results":[{          "__metadata":{              "uri":"http://ldcigkq.wdf.sap.corp:50080/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/CarrierCollection('AA')",              "type":"RMTSAMPLEFLIGHT.Carrier",              "content_type":"text/html",              "media_src":"http://ldcigkq.wdf.sap.corp:50080/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/CarrierCollection('AA')/$value",              "edit_media":"http://ldcigkq.wdf.sap.corp:50080/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/CarrierCollection('AA')/$value"},          "carrid":"AA",          "CARRNAME":"American  Airlines",          "CURRCODE":"USD",          "URL":"http://www.aa.com",          "mimeType":"text/html",          "carrierFlights":{              "__deferred":{                  "uri":"http://ldcigkq.wdf.sap.corp:50080/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/CarrierCollection('AA')/carrierFlights"}}},        {"__metadata":{              "uri":"http://ldcigkq.wdf.sap.corp:50080/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/CarrierCollection('JL')",              "type":"RMTSAMPLEFLIGHT.Carrier",              "content_type":"text/html",              "media_src":"http://ldcigkq.wdf.sap.corp:50080/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/CarrierCollection('JL')/$value",              "edit_media":"http://ldcigkq.wdf.sap.corp:50080/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/CarrierCollection('JL')/$value"},          "carrid":"JL",          "CARRNAME":"Japan  Airlines",          "CURRCODE":"JPY",          "URL":"http://www.jal.co.jp","mimeType":"text/html",          "carrierFlights":{              "__deferred":{                  "uri":"http://ldcigkq.wdf.sap.corp:50080/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/CarrierCollection('JL')/carrierFlights"}}}      ],      "__next":"http://ldcigkq.wdf.sap.corp:50080/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/CarrierCollection?$skiptoken=11"}   }   ©  2012 SAP AG. All rights reserved. 8
  • 9. OData Service Documents – The Starting Point An OData Service Document is a high level description of the server-side resources that are available for manipulation. It is retrieved using a URL. For example, issuing the URL http://odata.netflix.com returns: ©  2012 SAP AG. All rights reserved. 9
  • 10. OData Service Documents – General Structure The service tag defines a particular OData Service. <service>   This tag defines the starting point for service consumption. 1 The workspace tag contains a list of all server-side <workspace>   resources that are available for manipulation. 1 0..n A collection tag identifies an <title>   <collection>   individual server-side resource. 1 <title>   The <collection> tag will give you access to a server-side resource that can be manipulated in some way. This could be a single table (hence “ODBC for the Web”) or a set of business objects such as Sales Orders or Service Orders or Customers etc. ©  2012 SAP AG. All rights reserved. 10
  • 11. An Example of an OData Service Document – 1/2 <service  xml:base="http://odata.netflix.com/v2/Catalog/”          xmlns:atom="http://www.w3.org/2005/Atom"  xmlns="http://www.w3.org/2007/app”>      <workspace>          <title>Default</title>          <collection  href="Genres">              <title>Genres</title>          </collection>          <collection  href="Titles">              <title>Titles</title>   The service tag defines        </collection>          <collection  href="TitleAudioFormats">   an OData Service.            <title>TitleAudioFormats</title>          </collection>   The parameters define        <collection  href="TitleAwards">              <title>TitleAwards</title>   the base URL for the        </collection>   service and which        <collection  href="People">              <title>People</title>   namespaces will be used        </collection>          <collection  href="TitleScreenFormats">   to define the content            <title>TitleScreenFormats</title>          </collection>          <collection  href="Languages">              <title>Languages</title>          </collection>      </workspace>   </service>   This example is taken from Netflix’s online catalogue available at http://odata.netflix.com/v2/Catalog/   ©  2012 SAP AG. All rights reserved. 11
  • 12. An Example of an OData Service Document – 2/2 <service  xml:base="http://odata.netflix.com/v2/Catalog/”          xmlns:atom="http://www.w3.org/2005/Atom"  xmlns="http://www.w3.org/2007/app”>      <workspace>          <title>Default</title>          <collection  href="Genres">              <title>Genres</title>   The collection tag defines the relative        </collection>   URL and title of an individual collection        <collection  href="Titles">              <title>Titles</title>          </collection>          <collection  href="TitleAudioFormats">              <title>TitleAudioFormats</title>          </collection>          <collection  href="TitleAwards">   The workspace tag defines which collections            <title>TitleAwards</title>          </collection>   are provided by this OData Service        <collection  href="People">              <title>People</title>          </collection>          <collection  href="TitleScreenFormats">              <title>TitleScreenFormats</title>          </collection>          <collection  href="Languages">              <title>Languages</title>          </collection>      </workspace>   </service>   This example is taken from Netflix’s online catalogue available at http://odata.netflix.com/v2/Catalog/   ©  2012 SAP AG. All rights reserved. 12
  • 13. Accessing an OData Collection – Construct the URL Using the base URL defined in the service document’s <service> tag, we can now construct the correct URL to access any collection listed in the workspace: <service  xml:base="http://odata.netflix.com/v2/Catalog/”          xmlns:atom="http://www.w3.org/2005/Atom"  xmlns="http://www.w3.org/2007/app”>      <workspace>          <title>Default</title>          <collection  href="Genres">              <title>Genres</title>          </collection>            ...  snip  ...        </workspace>   </service>   http://odata.netflix.com/v2/Catalog/Genres When this URL is now issued, we will receive the contents of the “Genres” collection. ©  2012 SAP AG. All rights reserved. 13
  • 14. Accessing an OData Collection – A Structured Response In ABAP, this Corresponds to a row data would <feed>   in an ABAP table be in a table 1 1 1 1 0..n <title>   <id>   <updated>   <link>   <entry>   1 1 1 1..n 1 0..1 <title>   <id>   <updated>   <link>   <category>   <content>   1..n <properties>   Corresponds to a column in an ABAP table ©  2012 SAP AG. All rights reserved. 14
  • 15. Understanding OData XML – 1/4 <?xml  version="1.0"  encoding="iso-­‐8859-­‐1"  standalone="yes"?>   <feed  xml:base="http://odata.netflix.com/v2/Catalog/"          xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices”          xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"          xmlns="http://www.w3.org/2005/Atom">      <title  type="text">Genres</title>      <id>http://odata.netflix.com/v2/Catalog/Genres/</id>      <updated>2011-­‐10-­‐17T15:25:10Z</updated>      <link  rel="self"  title="Genres"  href="Genres"  />      <entry>          <id>http://odata.netflix.com/v2/Catalog/Genres('Action%20%26%20Adventure')</id>          <title  type="text">Action  &amp;  Adventure</title>          <updated>2011-­‐10-­‐17T15:25:10Z</updated>   The <feed> element        <author>              <name  />   defines a collection of        </author>          <link  rel="edit"  title="Genre"  href="Genres('Action%20%26%20Adventure')"  />   zero or more <entry>        <link  rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Titles”   elements                type="application/atom+xml;type=feed”                  title="Titles"  href="Genres('Action%20%26%20Adventure')/Titles"  />          <category  term="Netflix.Catalog.v2.Genre”                  scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"  />          <content  type="application/xml">              <m:properties>                  <d:Name>Action  &amp;  Adventure</d:Name>              </m:properties>          </content>      </entry>   </feed>   This example is taken from http://odata.netflix.com/v2/Catalog/Genres   ©  2012 SAP AG. All rights reserved. 15
  • 16. Understanding OData XML – 2/4 <?xml  version="1.0"  encoding="iso-­‐8859-­‐1"  standalone="yes"?>   <feed  xml:base="http://odata.netflix.com/v2/Catalog/"          xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices”          xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"          xmlns="http://www.w3.org/2005/Atom">      <title  type="text">Genres</title>      <id>http://odata.netflix.com/v2/Catalog/Genres/</id>      <updated>2011-­‐10-­‐17T15:25:10Z</updated>      <link  rel="self"  title="Genres"  href="Genres"  />      <entry>          <id>http://odata.netflix.com/v2/Catalog/Genres('Action%20%26%20Adventure')</id>          <title  type="text">Action  &amp;  Adventure</title>          <updated>2011-­‐10-­‐17T15:25:10Z</updated>          <author>              <name  />          </author>          <link  rel="edit"  title="Genre"  href="Genres('Action%20%26%20Adventure')"  />   The <entry> element        <link  rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Titles”                  type="application/atom+xml;type=feed”   contains the data for one                title="Titles"  href="Genres('Action%20%26%20Adventure')/Titles"  />   member of the feed’s        <category  term="Netflix.Catalog.v2.Genre”                  scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"  />   collection        <content  type="application/xml">              <m:properties>                  <d:Name>Action  &amp;  Adventure</d:Name>              </m:properties>          </content>      </entry>   </feed>   This example is taken from http://odata.netflix.com/v2/Catalog/Genres   ©  2012 SAP AG. All rights reserved. 16
  • 17. Understanding OData XML – 3/4 <?xml  version="1.0"  encoding="iso-­‐8859-­‐1"  standalone="yes"?>   <feed  xml:base="http://odata.netflix.com/v2/Catalog/"          xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices”          xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"          xmlns="http://www.w3.org/2005/Atom">      <title  type="text">Genres</title>      <id>http://odata.netflix.com/v2/Catalog/Genres/</id>      <updated>2011-­‐10-­‐17T15:25:10Z</updated>      <link  rel="self"  title="Genres"  href="Genres"  />      <entry>          <id>http://odata.netflix.com/v2/Catalog/Genres('Action%20%26%20Adventure')</id>          <title  type="text">Action  &amp;  Adventure</title>          <updated>2011-­‐10-­‐17T15:25:10Z</updated>          <author>              <name  />          </author>          <link  rel="edit"  title="Genre"  href="Genres('Action%20%26%20Adventure')"  />          <link  rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Titles”                  type="application/atom+xml;type=feed”                  title="Titles"  href="Genres('Action%20%26%20Adventure')/Titles"  />          <category  term="Netflix.Catalog.v2.Genre”                  scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"  />          <content  type="application/xml">              <m:properties>   The <content> element contains                <d:Name>Action  &amp;  Adventure</d:Name>              </m:properties>   the actual business data        </content>      </entry>   </feed>   This example is taken from http://odata.netflix.com/v2/Catalog/Genres   ©  2012 SAP AG. All rights reserved. 17
  • 18. Understanding OData XML – 4/4 <?xml  version="1.0"  encoding="iso-­‐8859-­‐1"  standalone="yes"?>   <feed  xml:base="http://odata.netflix.com/v2/Catalog/"          xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices”          xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"          xmlns="http://www.w3.org/2005/Atom">      <title  type="text">Genres</title>      <id>http://odata.netflix.com/v2/Catalog/Genres/</id>      <updated>2011-­‐10-­‐17T15:25:10Z</updated>      <link  rel="self"  title="Genres"  href="Genres"  />      <entry>          <id>http://odata.netflix.com/v2/Catalog/Genres('Action%20%26%20Adventure')</id>          <title  type="text">Action  &amp;  Adventure</title>          <updated>2011-­‐10-­‐17T15:25:10Z</updated>          <author>              <name  />          </author>          <link  rel="edit"  title="Genre"  href="Genres('Action%20%26%20Adventure')"  />          <link  rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Titles”   The <link> elements point                type="application/atom+xml;type=feed”                  title="Titles"  href="Genres('Action%20%26%20Adventure')/Titles"  />   to related business data        <category  term="Netflix.Catalog.v2.Genre”                  scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"  />          <content  type="application/xml">              <m:properties>                  <d:Name>Action  &amp;  Adventure</d:Name>              </m:properties>          </content>      </entry>   </feed>   This example is taken from http://odata.netflix.com/v2/Catalog/Genres   ©  2012 SAP AG. All rights reserved. 18
  • 19. Agenda u  Atom and OData – Building Towards a Business Interface u  Gateway – OData for the Enterprise u  Using Gateway – OData in Practice (Read Only) u  The QUERY operation – retrieving all or part of a collection u  The READ operation – retrieving a single entry from a collection u  Understanding the XML returned by the QUERY and READ operations u  Mapping OData properties to Atom elements ©  2012 SAP AG. All rights reserved. 19
  • 20. Obtaining OData Metadata In order to consume an OData service, you should retrieve the metadata that describes that service. This is done by adding the suffix $metadata to the Service Document URL. (OData metadata is only available in XML format, not JSON) E.G. http://odata.netflix.com/v2/Catalog/$metadata This will now return an Entity Data Model (edmx) XML description of the service: (There is currently no standard for representing EDMs in JSON; therefore, the metadata description of an OData service is only available in XML format) <edmx:Edmx  Version="1.0">      <edmx:DataServices  m:DataServiceVersion="1.0">          <Schema  Namespace="Netflix.Catalog.v2">              <EntityType  Name="Genre">                  <Key>                      <PropertyRef  Name="Name"/>                  </Key>                  <Property  Name="Name"  Type="Edm.String"  Nullable="false"  MaxLength="128"  Unicode="true”                          FixedLength="false"  m:FC_TargetPath="SyndicationTitle"  m:FC_ContentKind="text"  m:FC_KeepInContent="True"/>                  <NavigationProperty  Name="Titles"  Relationship="Netflix.Catalog.v2.Genre_Titles”                          FromRole="Genre_Titles_Source"  ToRole="Genre_Titles_Target"/>              </EntityType>              <EntityType  Name="Title"  m:HasStream="true">                  <Key>                      <PropertyRef  Name="Id"/>                  </Key>     ...  snip  ...   ©  2012 SAP AG. All rights reserved. 20
  • 21. SAP Extensions To OData Metadata The standard OData metadata is not able to fully describe all the information held in the ABAP Data Dictionary; therefore, the Gateway server will send extra metadata values identified by the sap: namespace prefix. <EntityType  Name="Booking"  sap:content-­‐version="1">      <Key>          <PropertyRef  Name="AirlineId"/>          <PropertyRef  Name="ConnectionNo"/>          <PropertyRef  Name="FlightDate"/>          <PropertyRef  Name="BookingId"/>      </Key>      <Property  Name="AirlineId”        Type="Edm.String”      Nullable="false"  MaxLength="3”                          sap:label="Airline"  sap:filterable="false"/>      <Property  Name="ConnectionNo"  Type="Edm.String"      Nullable="false"  MaxLength="4”                          sap:label="Flight  Number"  sap:filterable="false"/>      <Property  Name="FlightDate"      Type="Edm.DateTime"  Nullable="false"  Precision="10”                          sap:label="Date"  sap:filterable="false"/>      <Property  Name="BookingId"        Type="Edm.String"      Nullable="false"  MaxLength="8”                          sap:label="Booking  number"  sap:filterable="false"/>      <Property  Name="CustomerNo"      Type="Edm.String”      MaxLength="8”                          sap:label="Customer  Number"  sap:filterable="false"/>      <Property  Name="CustomerName”  Type="Edm.String"      MaxLength="25”                          sap:label="Passenger  Name"  sap:filterable="false"  m:FC_TargetPath="SyndicationAuthorName”  />      <Property  Name="Price"                Type="Edm.Decimal"    Precision="20"  Scale="2”                          sap:label="Airfare"  sap:filterable="false"/>      <Property  Name="CurrencyCode"  Type="Edm.String"      MaxLength="5”                          sap:label="Airline  Currency"  sap:filterable="false"  sap:semantics="currency-­‐code"/>      <Property  Name="BookingDate”    Type="Edm.DateTime"  Precision="10”                          sap:label="Booking  date"  sap:filterable="false”/>     ...  snip  ...   ©  2012 SAP AG. All rights reserved. 21
  • 22. Agenda u  Atom and OData – Building Towards a Business Interface u  Gateway – OData for the Enterprise u  Using Gateway – OData in Practice (Read Only) u  The QUERY operation – retrieving all or part of a collection u  The READ operation – retrieving a single entry from a collection u  Understanding the XML returned by the QUERY and READ operations u  Mapping OData properties to Atom elements ©  2012 SAP AG. All rights reserved. 22
  • 23. Agenda u  Atom and OData – Building Towards a Business Interface u  Gateway – OData for the Enterprise u  Using Gateway – OData in Practice (Read Only) u  The QUERY operation – retrieving all or part of a collection u  The READ operation – retrieving a single entry from a collection u  Understanding the XML returned by the QUERY and READ operations u  Mapping OData properties to Atom elements ©  2012 SAP AG. All rights reserved. 23
  • 24. Entity Data Model – Overview In the following examples and exercises, we will be using the data model shown below: More information will be given about the details of this data model in later chapters. ©  2012 SAP AG. All rights reserved. 24
  • 25. Retrieving a Collection – ReadEntitySet Operation 1/3 To start with, we will cover the simplest two operations that can be performed using OData: ReadEntitySet and ReadEntity (also referred to as QUERY and READ). ReadEntitySet (QUERY) : Returns 0..n entries from a collection ReadEntity (READ) : Returns 0..1 entries from a collection Both operations are read-only and therefore use the HTTP GET method. REST Operation HTTP Method Create a resource POST Retrieve one or more resources GET Update a resource PUT Delete a resource DELETE ©  2012 SAP AG. All rights reserved. 25
  • 26. Retrieving a Collection – ReadEntitySet Operation 2/3 To start running a Gateway Service, you must know the service’s base URL. This value is generated when the Gateway Service is first created. The URL for an entire collection is formed by taking the URL found in the Gateway Service’s xml:base parameter and appending to it the value of the href parameter for the required collection. <app:service  xml:base="http://mysapgateway.com/sap/opu/odata/sap/FlightInformation/">     together with   <app:collection  href="Airports"  sap:content-­‐version="1">   Gives http://mysapgateway.com/sap/opu/odata/sap/FlightInformation/Airports   Since we need to use the HTTP GET method, this URL can be issued directly from the browser’s address line.   ©  2012 SAP AG. All rights reserved. 26
  • 27. Retrieving a Collection – ReadEntitySet Operation 3/3 Issuing this URL from the browser’s address line will cause the Gateway server to return an OData XML message containing the requested collection. ©  2012 SAP AG. All rights reserved. 27
  • 28. Retrieving a Partial Collection – Filtering If a collection has a high number of entries, then you can filter the <feed> contents by using the $filter query string parameter: Assuming a base URL of http://mysapgateway.com/sap/opu/odata/sap/FlightInformation/     Then appending Airports?$filter=IATACode  eq  'FRA' will filter out all airports except Frankfurt.   IMPORTANT! 1.  You must implement the ABAP coding that responds to this parameter 2.  A space character (or %20) must be included on either side of the operator in the $filter condition. 3.  If the property value being filtered is non-numeric, then it must be enclosed within single quotes. For more information on $filter, see: http://www.odata.org/developers/protocols/uri-­‐conventions#FilterSystemQueryOptions   Please note, SAP NetWeaver Gateway does not support all $filter options ©  2012 SAP AG. All rights reserved. 28
  • 29. Retrieving a Partial Collection – Paging If a collection has a high number of entries, then you can use the $top and $skip parameters together to implement paging. Individually, Airports?$top=5 would reduce the <feed> down to the first 5 entries. And Airports?$skip=5 would omit the first 5 entries from the <feed>.   Paging is achieved by setting $top to the number of entries per page, and then incrementing $skip by this number every time the next page is required. Assuming 10 entries per page, then to: View the first page : Airports?$top=10   View the second page : Airports?$skip=10&$top=10   View the third page : Airports?$skip=20&$top=10   etc. For more information on $top, and $skip, see: http://www.odata.org/developers/protocols/uri-­‐conventions#TopSystemQueryOption and following. ©  2012 SAP AG. All rights reserved. 29
  • 30. Agenda u  Atom and OData – Building Towards a Business Interface u  Gateway – OData for the Enterprise u  Using Gateway – OData in Practice (Read Only) u  The QUERY operation – retrieving all or part of a collection u  The READ operation – retrieving a single entry from a collection u  Understanding the XML returned by the QUERY and READ operations u  Mapping OData properties to Atom elements ©  2012 SAP AG. All rights reserved. 30
  • 31. Retrieving a Single Entry – ReadEntity Operation 1/2 Below is one entry from the Airports collection in the FlightInformation service. Notice that each <entry> element contains one or more <link> elements. <entry>        ...  snip  ...        <link  href="Airports('FCO')"  ...  snip  .../>      <link  href="Airports('FCO')/AirportsTo”  ...  snip  ...  />      <link  href="Airports('FCO')/DepartingFlights”  ...  snip  ...  />      <title>ROME  -­‐  FCO</title>      <updated>2011-­‐10-­‐19T08:38:00Z</updated>   </entry>   The href parameter of the first <link> element contains a self-reference to the current <entry>   ©  2012 SAP AG. All rights reserved. 31
  • 32. Retrieving a Single Entry – ReadEntity Operation 2/2 The first <link> element is always a self-reference. It contains the relative URL for reading the current entry from the collection. <link  href="Airports('FCO')"  ...  snip  .../>   IMPORTANT: The conventional query string syntax is not used here! Instead, the collection name is immediately followed by a comma separated list of name/value pairs, all enclosed within parentheses. This is known as the “Key Predicate”. CollectionName This non-standard URL syntax is needed so that the OData server can distinguish a READ operation (0..1 entries) from a QUERY operation (0..n entries) ©  2012 SAP AG. All rights reserved. 32
  • 33. Agenda u  Atom and OData – Building Towards a Business Interface u  Gateway – OData for the Enterprise u  Using Gateway – OData in Practice (Read Only) u  The QUERY operation – retrieving all or part of a collection u  The READ operation – retrieving a single entry from a collection u  Understanding the XML returned by the QUERY and READ operations u  Mapping OData properties to Atom elements ©  2012 SAP AG. All rights reserved. 33
  • 34. XML Returned by ReadEntitySet and ReadEntity – 1/2 A ReadEntitySet operation will return zero or more entries; therefore, the OData XML will always be contained within an <feed> element – even if the filter options result in only one entry being returned. Zero or more <entry> elements It is perfectly valid for a ReadEntitySet operation to return zero <entry> elements. ©  2012 SAP AG. All rights reserved. 34
  • 35. XML Returned by ReadEntitySet and ReadEntity – 2/2 A ReadEntity operation will return zero or one entry. Therefore the OData XML will never be contained within an <feed> element. Instead, a single <entry> element will be returned. ©  2012 SAP AG. All rights reserved. 35
  • 36. Agenda u  Atom and OData – Building Towards a Business Interface u  Gateway – OData for the Enterprise u  Using Gateway – OData in Practice (Read Only) u  The QUERY operation – retrieving all or part of a collection u  The READ operation – retrieving a single entry from a collection u  Understanding the XML returned by the QUERY and READ operations u  Mapping OData properties to Atom elements ©  2012 SAP AG. All rights reserved. 36
  • 37. Standard ATOM Elements – 1/2 Within an <entry> element, there is always an <content> element. This element contains zero or more OData properties. However, since OData is based on Atom, there are elements outside the <content> element that are also significant. ©  2012 SAP AG. All rights reserved. 37
  • 38. Standard ATOM Elements – 2/2 These Atom elements are: <author>, (which may itself contain <email>, <name> and <uri>), <published>, <rights>, <summary>, and <title>. For example: <author>      <name>Siegfried  Mechler</name>   </author>     <title  type="text">      Booking  for  Siegfried  Mechler  on  flight  AA0017  on  20111207   </title>   It is possible to map OData properties into these standard Atom elements. This is useful if you wish to display an OData message using an Atom Feed parser such as a browser. ©  2012 SAP AG. All rights reserved. 38
  • 39. Mapping OData Properties to ATOM Elements – 1/2 If the coding in your Gateway Service does not explicitly map any OData properties to the standard Atom elements, then the Gateway runtime will automatically populate the <title> field with a default value. Default value for the <title> element ©  2012 SAP AG. All rights reserved. 39
  • 40. Mapping OData Properties to ATOM Elements – 2/2 When writing the coding for a Gateway Service, you can map an OData property to an Atom element. Here the <title> element has been supplied with data from an OData property. The value from an OData property has now been mapped to the <title> element ©  2012 SAP AG. All rights reserved. 40
  • 41. Summary You should now be able to Ÿ  The architecture of the Atom and OData protocols Ÿ  How SAP NetWeaver Gateway makes use of OData Ÿ  How to issue read-only OData requests from your browser ©  2012 SAP AG. All rights reserved. 41
  • 42. APPENDIX u  Differences Between Atom and OData Terminology u  Displaying Atom XML in a Browser ©  2012 SAP AG. All rights reserved. 42
  • 43. APPENDIX u  Differences Between Atom and OData Terminology u  Displaying Atom XML in a Browser ©  2012 SAP AG. All rights reserved. 43
  • 44. Atom and OData Terminology OData has defined some terminology that differs from the Atom terminology, but in fact refers to the same things. Atom OData Feed Collection / EntitySet Entry Entity The terms Entity and EntitySet will appear when using the ABAP OData API but are interchangeable with the Atom terms Entry and Collection. ©  2012 SAP AG. All rights reserved. 44
  • 45. APPENDIX u  Differences Between Atom and OData Terminology u  Displaying Atom XML in a Browser ©  2012 SAP AG. All rights reserved. 45
  • 46. Displaying Atom XML in your Browser You may find that your browser does not display Atom XML in a formatted manner. This is due to the MIME type used by the Gateway server. The Gateway server returns XML with a MIME type of application/atom+xml   Most modern browsers will interpret this as an Atom feed and format the results in the manner shown here. If you want to see the indented XML, then you add the query string parameter sap-­‐ds-­‐debug=true. This causes the Gateway server to format the XML and present it as an HTML page. ©  2012 SAP AG. All rights reserved. 46
  • 47. © 2012 SAP AG. All rights reserved No part of this publication may be reproduced or transmitted in any form or for any purpose Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal without the express permission of SAP AG. The information contained herein may be Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services changed without prior notice. mentioned herein as well as their respective logos are trademarks or registered trademarks of Business Objects Software Ltd. Business Objects is an SAP company. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere, and other Sybase Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Sybase, Inc. Sybase is an SAP company. Corporation. All other product and service names mentioned are the trademarks of their respective IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, companies. Data contained in this document serves informational purposes only. National System z, System z10, System z9, z10, z9, iSeries, pSeries, xSeries, zSeries, eServer, z/ product specifications may vary. 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, The information in this document is proprietary to SAP. No part of this document may be OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS, HACMP, reproduced, copied, or transmitted in any form or for any purpose without the express prior RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX, Intelligent written permission of SAP AG. Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of This document is a preliminary version and not subject to your license agreement or any IBM Corporation. other agreement with SAP. This document contains only intended strategies, developments, Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. and functionalities of the SAP® product and is not intended to be binding upon SAP to any Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered particular course of business, product strategy, and/or development. Please note that this document is subject to change and may be changed by SAP at any time without notice. trademarks of Adobe Systems Incorporated in the United States and/or other countries. SAP assumes no responsibility for errors or omissions in this document. SAP does not Oracle is a registered trademark of Oracle Corporation. warrant the accuracy or completeness of the information, text, graphics, links, or other items UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. contained within this material. This document is provided without a warranty of any kind, Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are either express or implied, including but not limited to the implied warranties of trademarks or registered trademarks of Citrix Systems, Inc. merchantability, fitness for a particular purpose, or non-infringement. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World SAP shall have no liability for damages of any kind including without limitation direct, special, Wide Web Consortium, Massachusetts Institute of Technology. indirect, or consequential damages that may result from the use of these materials. This limitation shall not apply in cases of intent or gross negligence. Java is a registered trademark of Sun Microsystems, Inc. The statutory liability for personal injury and defective products is not affected. SAP has no JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for control over the information that you may access through the use of hot links contained in technology invented and implemented by Netscape. these materials and does not endorse your use of third-party Web pages nor provide any SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP BusinessObjects Explorer, warranty whatsoever relating to third-party Web pages. StreamWork, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries. ©  2012 SAP AG. All rights reserved. 47