Skip to Content

Working with REST Adapter: A REST to SOAP Scenario in SAP PI/PO

Working with REST Adapter: A REST to SOAP Scenario in SAP PI/PO

Introduction: With the introduction of the REST Adapter in SAP PI/PO, consuming a REST service or exposing a REST service in PI becomes more fun. This is with respect to the fact that the SAP PI/PO ESB extends its capabilities to handle and process REST-based messages (XML, JSON) easily. Prior to this time, implementing or consuming a REST-based service had to be done via third party adapters (e.g Advantco) or manipulation of the AXIS Framework within SAP PI, which is often a tough task. In this blog, my aim is to highlight simple steps needed to expose a REST-based service in SAP PI/PO. An end-to-end implementation of simple REST to SOAP scenario is described.

Prerequisite: SAP NetWeaver 7.31 SP14 or SAP NetWeaver 7.40 SP 09 and above, knowledge of creating objects in Enterprise Service Repository and Integration Builder.

Scenario: The REST to SOAP scenario is implemented such that, an XML-based/JSON-based request is triggered from SOAP UI/Chrome REST Client. It is received by the Configured REST Adapter, processed and passed to the Receiver SOAP Adapter (configured to connect with the currency converter webservice from ).

REST-WS Scenario.gif

Figure: Exposing REST-based Service via SAP PI as shown in REST-to-SOAP Scenario diagram

ESR and Configuration Objects: In this scenario, the necessary ESR objects creation steps are only listed below, with more emphasis on the configuration.

ESR Objects: Create the following ESR objects

1)      Download the WSDL from:

2)      Import the WSDL as external definition in the sender and receiver namespaces

3)      Create the service interfaces for sender and receiver (use the same XSD on both sides)

4)      Create the message mappings and operation mappings

Directory Objects: Described below the necessary configurations steps for each object;

Sender REST Adapter: Create the Sender Communication channel by selecting the “REST Adapter” option.  Configure the REST Adapter as show below;

  • Input message format: XML
  • Quality of Service: Best Effort
  • Output message format: XML

2015-03-31 17_05_56-Configuration_ Integration Builder (rojodemo_P74_00).gif

Figure: Sender REST Adapter Configuration with input message as XML

Navigate to the “Channel Selection” and specify a URL path.  This is optional, but useful to distinguish the different scenarios exposing REST-based services in SAP PI, as this will be added in the URL of the sender application (in this case: SOAP UI).

2015-03-31 17_19_04-Configuration_ Integration Builder (rojodemo_P74_00).gif

Figure: Sender REST Adapter Configuration Endpoint

Receiver SOAP Adapter: Create the receiver communication channel and provide the necessary connection details to the currency converter webservice.

2015-03-31 17_23_28-Configuration_ Integration Builder (rojodemo_P74_00).gif

Figure: Receiver SOAP Adapter Configuration

Integrated Configuration: Configure the integrated configuration (ICO) using the sender and the receiver channels created earlier.

Test the Scenario with XML: To test the scenario, SOAP UI is used as the sender application. The endpoint URL to fire the message to is constructed as shown below;


eg: http://xxxxxxx:50000/RESTAdapter/Rojo/CurrencyConverter/201503

Obtain a sample XML message from the test tab of the “Message Mapping” object in the ESR to be used as the XML to be sent from SOAP UI.

2015-03-31 17_33_50-soapUI 4.5.0-Beta 2.gif

Figure: XML Request message from SOAP UI

Change The Sender Adapter Configuration (for JSON to XML conversion)

In addition to the above test, change the sender adapter configuration from XML to JSON, so that SAP PI receives a JSON request message from SOAP UI;

  • Input message format: JSON with the following additional configuration
  • Convert to XML
  • Add wrapper element
  • Element name (name of the request message as in the XSD in ESR)
  • Element namespace (namespace of the request as in the XSD in ESR)
  • Quality of Service: Best Effort
  • Output message format: XML

2015-04-03 15_22_41-_ BC_DemoBPM _ CC_Currency_REST_Send_ Display Communication Channel.gif

Figure: Sender REST Adapter Configuration with input message as JSON

Test the Scenario with JSON: To test the scenario, SOAP UI is used as the sender application. The endpoint URL to fire the message to is the same as in the previous test. The SOAP UI JSON request and response messages are shown below;

2015-04-03 15_26_55-soapUI 4.5.0-Beta 2.gif

Figure: JSON Request from SOAP UI

2015-04-03 15_35_47-RESTClient.gif

Figure: JSON Request from Chrome REST Client

The results of the calls to consume the exposed REST service in SAP PI based on the REST adapter are also shown above in both test cases.

Conclusion: With this blog, I have been able to provide an insight into how to expose a REST service in SAP PI/PO using the REST Adapter as the sender communication channel. Additional settings of the adapter can also be used as well, e.g. sending a JSON message as input or output message.

You must be Logged on to comment or reply to a post.
  • Hi Olatunbosun,

    Thanks for such an informative bog post. I was trying to implement the same scenario but I am getting following error in SOAPUI tool  No channel found to handle "POST" Request to /Rojo/CurrencyConvertor/201503. Can u help to resolve this issue also,

    1. The same path is given in REST sender adapter in Channel Selection.

    2. Used ConvsersionRateSOAPIn XSD at both the ends.

    Thanks in advance.

    • Thanks A. Olatunbosun for such an informative blog.

      Hello Nav Mrid,

      You need to set the following parameter to get rid off the error that you are getting. Please find the below.

      Rest resources.PNG

      rest operation.PNG

      Rest all settings are given by A. Olatunbosun in this blog.



  • Hi olatunbosun,
    Thanks for such an informative bog post, is very interesting. I was trying to implement the same scenario, but, im getting a error in the url and soapui. I have this error in the url No channel found to handle "GET" request to "/Rojo/CurrencyConverter/201503" and this in the soapUI

    Error loading [http://aaarba066:50000/RESTAdapter/Rojo/CurrencyConverter/201503]: org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException: error: does not close tag.

    I hope you can help me
    thanks in adnvance

  • Hello Olatunbosun,

    Thanks a lot for the blog.
    Could you please explain if we need any other settings in PI. May be REST API or so. anything that is not included in this blog, please explain.

  • /
  • Hi,

    Very well explained.

    Can you help me how to append username and password for the URL generated by REST channel ?

    Since the login is mandatory for our requirement I am asking this.