Acorel
To Acorel.nl
Acorel background

Odata Provisioning in SAP Cloud Platform Integration

Amber Badam, 27 September 2017
In Todays world there are quite some ways of designing and consuming API’s. Most of the API’s do not follow a uniform pattern. OData solves this problem by providing a uniform way to expose, structure, query and manipulate data using REST practices and JSON or ATOM syntax to describe the payload. OData also provides a uniform way to represent metadata about the data, allowing computers to know more about the type system, relationships and structure of the data.

SCP-IS is now capable of Provisioning Odata services from existing data sources such as SOAP, REST and Odata Services which could be further consumed by mobile APPs or an FIORI App. In this blog, we will see how we could create an OData model definition, implement the OData service which includes binding to a data source (SOAP Web Service), go through the steps to create an Odata Service which we could query and get the list of Continents.

Create an new Odata Service Artifact as below. In the below screen you could either create a new one or import from your local file system. In the SAP SCI-PI Web application go to the Design tab and then choose Create.Enter the required data  to create a new integration package. In the Artifacts section, choose Add  OData Service. In the Add OData Service Artifact dialog box, enter the OData service details as listed in the following table.


Step 1: Create Odata Model Definition

SAP SCP-IS allows you to create an OData model by importing the model definition from an existing data source, such as SOAP and OData. An import wizard guides you in this process with for selecting the Data Source Type and buidling the EDMX Structure for the OData Model.

In the below screen Choose Import Model Wizard and select the WSDL from file system. Select the Structure and the elements for the OData Model. In the case below, we select the response structure of ListofContinetsByCode service from the WSDL hierarchy.

You could maintain the documentation for the elements selected. Click “Finish” to see the subsequent screen.
In this Service Designer page, you have the ability to edit the generated Odata model. Clicking on the OData Model Editor navigates you to EDMX file editor.
Here you can manually add new subelements like associations, new entity, Associations etc.

Step 2: Binding OData object to SOAP Data Source

Choose SOAP as the datasource and click on the bind to associate Query operation associated with SOAP Service. In the following Configure SOAP Data Source, Select the WSDL and the required operation. The endpoint is auto populated as defined from the WSDL.

Step 3: Editing an Integration Flow

Click on the Integration Flow Editor which takes you to a predefined integration flow with mapping steps already generated for the operation. 

Most of the details are pre-filled. No change required in the sender OData Channel. 

Since we are interested in getting all of the Continent codes, we insert the following XML in the message body of the content modifier as below.
<key:ListOfContinentsByCode xmlns:key=”http://www.oorsprong.org/websamples.countryinfo” >
</key:ListOfContinentsByCode>
Click on the Mapping below and map the fields as below.
Finally populate the service and operation, if they are not pre-filled.

Step 4: Deploy OData Service

Save and deploy the OData service. It might take a few minutes for the flow to be started.

End point of the OData Service does not show up in the monitoring. If the artifact is an OData service or an integration flow with an OData adapter configured as the sender channel, the endpoint URL is currently not available. You can construct the endpoint URL in the following format:

<IFLMAP URL>/gw/odata/<OData Service Namespace>/<OData Service Name>;v=1

Call the following URL in a browser or use any Rest client with “GET” to get the results.
https://xxxx-iflmap.hcisbp.eu1.hana.ondemand.com/gw/odata/SAP/CountryInfoService;v=1

In order to get the results, provide the entity set in the URL
https://xxxx-iflmap.hcisbp.eu1.hana.ondemand.com/gw/odata/SAP/CountryInfoService;v=1/ListOfContinentsByCodeSet

There are numerous of possibilities of adding filters to the URL and adding capabilities on service. More detailed documentation on this OData Service could be found here

This is still offered as the beta service, which means by default this service is not active as an out of the box SCP-IS . You can initiate the Test and Evaluation Agreement acceptance process by raising a ticket using SAP issue reporting tool, BCP, on the component LOD-HCI requesting for this OData Service.
Happy Interfacing!

Receive our weekly blog by email?
Subscribe here: