This blog is a continuation of the sync scenario using the REST adapter in SAP PI. Here we will cover the configuration steps for JSON format.
In case you want to read about XML format here is a link to 1st part of this blog Sync Scenario using REST adapter in SAP PI – Part I
Scenario :
REST adapter can be used for consuming a REST service or exposing a REST service in PI. This blog will cover only exposing of REST service for which Sender REST Adapter will be used.
Flow:
REST<–> SAP PI<–>SOAP ( calculator service)
It will be a synchronous scenario where the request will send to PI and response will be received based on the operation (Add, Sub, Divide or multiple).
To keep it simple we will only work with add operation, for multiple operation check this guide REST Adapter with Multiple Operations in SAP PI
In case you are looking for Async example here is a step by step guide REST Adapter scenario in SAP PI – JSON/XML
ESR Configuration:
I am not going to show each object as these are already explained in 1st part of this blog follow the link above.
Create the following objects
- Data Type
- Message Type
- Sync Service interface Inbound/Outbound
- Message Mapping
- Operation Mapping
Configuration:
Create Sender REST Adapter:
choose the data format for request/response as JSON.
The rest of the steps will be the same as part I. Now let us test the scenario.
Testing:
Input payload
{
“Num1”: “2”,
“Num2”: “1”
}
You like :
Async Scenario using REST Adapter— REST Adapter scenario in SAP PI – JSON/XML
Mutiple Operations in REST Adapter —REST Adapter with Multiple Operations in SAP PI
SAP reference : https://help.sap.com/doc/saphelp_nw75/7.5.5/en-US/c8/0bd82a4a4c4408925110371b9a7643/content.htm?no_cache=true