REST Adapter scenario in SAP PI – JSON/XML

This blog will provide a step-by-step guide on how to configure the sender REST adapter scenario in SAP PI. This document will help the PI developer/consultant who will like to learn about the Sender REST adapter configuration.

I will explain this by creating a simple asynchronous scenario REST –> PI –> File. usually, REST will be used for sync scenario but to provide

Usually, REST will be used for sync scenarios but to provide a basic understanding of how to configure REST adapter I am using Async.

In case you are interested in sync scenario here is a step by step guide Sync Scenario using REST adapter in SAP PI

REST Adapter scenario in SAP PI

Rest enabled application will send JSON format to SAP PI which will be converted into XML using REST Adapter.

Step 1: Create ESR objects and mapping

I am not going to show each object but create a simple Data Type for learning.

Create the following objects

  • Data Type
  • Message Type
  • Async Service interface Inbound/Outbound
  • Message Mapping
  • Operation Mapping

Step 2: Create configuration objects

I am using Iflow so basically, it will look like below

PI version used in 7.5

Sender REST Adapter configuration

Configure the General tab

Convert to XML need to be enabled.

Log JSON message is enabled so this will log the JSON format in PI monitoring. This is an optional parameter.

Add Wrapper Element is a message type name that was created in Step 1.

Channel Selection is an EndPoint configuration any name can be given here.

In this case, the endpoint will look like

http://:/RESTAdapter/test/

REST Resource tab

REST Operation tab

Now configure Receiver channel in this case I have used NFS to write files locally.

Step 3: Testing of REST Adapter scenario

Testing can be done by using SOAP GUI, Chrome REST adapter, etc.

I am using Chrome REST adapter client which is a very lightweight app

Download using below link

Chrome REST Adapter Client

Once downloaded open the client and configure as shown below and hit the SEND button.

if the request is successfully processed to PI it will show 202 accepted.

 

Check the File system —-if the file is created

XML will look like

Check out more REST Adapter Blogs

Sync Scenario using REST adapter in SAP PI

REST Adapter with Multiple Operations in SAP PI

Sender REST Adapter Configuration

Error Handling in REST Adapter – SAP PI

Read More about REST adapter

https://blogs.sap.com/2014/12/18/pi-rest-adapter-blog-overview/

 

3 thoughts to “REST Adapter scenario in SAP PI – JSON/XML”

  1. hi,Will we be able to view the message logs in SAP PO for rest ->rfc scenario ,if we are testing through SOAP UI. we are able to view channel logs but no channel logs.

    1. Hi Sri,

      Thanks for reading our blog.
      Yes you will be able to see all the logs, try changing ICO settings to capture the logs.
      Let us know if you still facing issue, we will provide more details with screenshots.

      Thanks,
      TTZ Team

  2. Meenakshi says:

    Thanks for the explanation.
    I have a requirement of changing existing SOAP scenario to REST .
    Can you give an idea hoe to approach for the development.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.