This blog is part of a collection of blog entries that shows architectural concepts and configuration of the SAP PI REST Adapter. We also added some sample scenarios to make it easier for you to understand how your scenario can be implemented using the PI REST Adapter.

If you haven’t done so far, best is to start with the very first blog PI Rest Adapter – Don’t be afraid within the blog series covering the concepts of the REST adapter. A complete list of all blog entries can be accessed from here PI REST Adapter – Blog Overview.

The current blog shows you along a sample scenario how to define a dynamic endpoint using a placeholder.

Scenario

We will enhance the flight scenario from the previous blog PI REST Adapter – JSON to XML conversion where a travel agency gathers flight details from an airline. Besides the flight details query, the travel agency likes to check the availability of flights. Depending on the respective service name as part of the endpoint URL, the travel agency either calls BAPI_FLIGHT_GETDETAIL or BAPI_FLIGHT_CHECKAVAILABILITY.

In the SAP Process Integration Designer perspective of the NetWeaver Developer Studio (NWDS), we open the existing Integration Flow and add an interface split together with the new inbound interface. Select the interface split, and maintain the condition. In the condition, we use the adapter specific message attribute with name service and namespace https://sap.com/xi/XI/System/REST. The attribute is set within the REST sender channel, see below. For service equals getdetail, the request is routed to BAPI_FLIGHT_GETDETAIL. For service equals checkavail, the request is routed to BAPI_FLIGHT_CHECKAVAILABILITY.

Configuring the REST sender adapter

Double-click on the sender channel of type REST, and switch to the REST Resources tab below the Adapter-Specific tab. We would like to pass the service name as part of the endpoint URL, so we define the custom pattern as /{service_part} whereas service_part is a placeholder which is filled during runtime.

The REST adapter comes with a set of predefined adapter specific message attributes such as resource, service, and id which are commonly used among RESTful services. We use the service attribute to hold the name of the service. As dynamic attribute select REST Service (service) from the drop down menu. The Value Source is the beforehand defined URL Pattern Element service_part.

The rest of the configuration remains unchanged. For details, refer to the blog PI REST Adapter – JSON to XML conversion.

Running the scenario

For testing the scenario we use the Advanced REST Client Application in the Google Chrome browser. The endpoint URL of the RESTful service starts with

The response provides us the number of seats available in JSON format.

For requesting the flight details, we call the URL

The response provides us the flight details such as destination and schedule in JSON format.

You can access the dynamic attributes values from the DynamicConfiguration message header. In the message monitor, select the corresponding message, switch to tab Message Content, and open the DynamicConfiguration message header.

Here you can see that the service attribute value is either checkavail or getdetail.

I hope this blog was helpful to understand the options that you have to define custom endpoints within the SAP PI REST adapter. If you like to learn more, check out the other blogs in the series, accessible from the main blog PI REST Adapter – Blog Overview.

New NetWeaver Information at SAP.com

Very Helpfull

User Rating: Be the first one !