Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Dear All,

I have little struggled on REST adapter when fetching the data from rest web service using SAP standard REST adapter. But I have achieved on this requirement with the help from SAP document , Alexander's Blog & SAP thread

http://help.sap.com/saphelp_nw74/helpdata/en/d4/ee3eca7baf436b996e2473c04809b4/content.htm

PI REST Adapter - Polling a REST API

Restful webservice-source

Prerequisites on this REST sender poll:

PI 7.31 SP 16 (or) PO 7.4 SP11

SAP XI AF java component should be the latest patch level 1( Available up to today) and please make sure all dependent components should be update when you update SAP XI AF.

As you know from PI 7.31 SP 14 (or) PO 7.4 SP 11, SAP has introduced standard REST features. and they keep on adding the features. the latest one is available on  PI 7.31 SP 16(or) PO 7.4 SP 11 and it contains Rest Sender Adapter poll.

This feature is exactly match with my requirement(REST API-->PI-->JDBC) when PI wants to use GET operation (for fetching data from Rest API)

My REST API gives JSON format, so PI must converts into XML format for understand, mapping, routing.. etc. So I used REST sender poll adapter which is avialable  on PI 7.31 SP 16 (or) PO 7.4 SP 11.

My sample JSON Format


{"projects":[{"PKZ":"AO000","projectState":"yes","projectName":"xyz"},

{"PKZ":"BE000","projectState":"no","projectName":"abc"}]}

My JSON structure is very big , but I short you for very few fields with values. see in my JSON , "projects" is root tag of JSON and there are two datasets.


According to JSON format, I have created the datatype, message type in ESR( the data type structure is very important, you need to create right way according to your JSON structure)



see in the screen shot 'projects' should be 0 ... unbounded , because we have multiple datasets on JSON.


Importantant Note: I heard from some blogs multiple data sets not possible to convert JSON to XML ,but on PI 7.31 SP 16 (or) PO 7.4 SP 11 is possible to convert multiple data sets, so we do not need any customer adapter modules



See I only added screen shot of Datatype which created on PI ESR. I do not cover any data type structure of JDBC, message type, Message interfaces, mapping... etc. You can create as usual according normal integration scenario.



Integration Directory settings

This is my sample REST Web service URL:  https://tools-dev:9007/ceres/data/basic?lastChangedTime=2015-06-01T01:00:00Z

But i have to generate dynamic value on URL when PI calls the Rest web service  using GET operation. so we need to set up our connection according to that.




Sender Adapter poll:


See in the REST sender adapter , we can able choose REST (or) REST Pooling in the message protocol, selected REST polling according my requirement


Now in the 'General' tab. i used only basis authentication. Note: but make sure if your web sevice requires certificate based login then use client certificate authentication check box. in my case I just imported REST web service certificate into PI NWA but I didn't used the client certificate authentication section . in my case I get  error without certificate import.

Quality of Service: Exactly once  (because i used asynchronous)

In the HTTP Request tab, specify your HTTP/HTTPS url for call Rest API webservice and choose REST operation and Polling Interval.

See in the URL I used "{incrementalToken}" for generation of Dynamic value using Incremental Requests

(Setting up Incremental RequestsFor REST APIs that allow incremental requests, the adapter allows to store the timestamp of the latest call or a custom value (specified by an XPath expression or a JSON element). The value will be stored between the calls and can be referenced in the REST URL as a placeholder with name incrementalToken)

HTTP operation : GET

Polling Interval time : accroding to your freequency of Data

In the ' Data Format ' Tab choose data type format that PI receives from Rest

Check the box that "convert JSON to XML

ADD Wrapper element section : Put your message type which has created in ESR and Namesapce of message type

In the same tab "Data format" there are  few more other options to use. but in my case I used only "incremental Requests" for generate the dynamic value on REST URL when PI calls the REST web service for fetch data(GET)


See in the incremental Requests section, I choose the incremental type is "Timestamp of Last call"

Time stamp format should be ISO 8601

initial value  for one time request( it should require)


I hope it will help you how to use Rest Sender poll adapter

In this blog I only pointed out how you can fetch the data  using sender REST poll adapter. I do not concentrating on Target side.

Thanks & Best Regards,
Sateesh

16 Comments
Labels in this area