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!
Showing results for 
Search instead for 
Did you mean: 
Former Member

Hi Everybody, Greetings from Colombia.  This is my first Blog.

This is a step by step example of how to setup a Sender RESTAdapter Channel (with the Operation PUT), and how to test it using the Chrome Plugin and a simple JAVA Class.  I won't explain how to build the Mapping and the other side of the integration.

System: SAP PI 7.4 SP11

This example will follow this workflow:

JAVA <-> PI RESTAdapter (JSON) <-> PI Mapping (XML) <-> PI JDBCAdapter (XML) <-> Oracle SP

Bussiness Case Description

A Java class consumes a REST service published in PI to check if an ID (nmDni) represents a risk to the company.


Message Mapping

The datatype must have a field nmDni, named just like the parameter that we are going to send in the JSON payload.

Communication Channel

We will be working with the Adapter Type REST in the communication channel.  Follow the next screenshots to set up the channel:

General Tab

Here it's important to set the Element Name with the request Message Type, so the JSON structure can be recognized in the request

Channel Selection Tab

REST Resources Tab

Here it's very important to set the JSON Element that will match with the datatype defined in PI nmDni

Rest Operation Tab

The last 2 tabs are left empty

  • Operation Determination
  • Error Handling

Activate and assign the channel to the ICO in the Integration Builder.



The ping on the channel, in the Communication Channel Monitor, you can get the endpoint and check the pattern of the parameter that we will use in the testing fase.

Chrome Plugin

Download and install the Advance REST Client plugin for Google Chrome.

Put the endpoint and select the PUT operation.  In the payload section paste this code:




Clic the "Send" button and the response should appear in JSON format :grin:

Java Class

Here it's the Java class that will work to test the REST Service.  It's important to notice, that you need a PI user and password.  That user and password is encoded using Base64 library.







import sun.misc.BASE64Encoder;

public class PruebaRestMAIN {

    public static void main(String[] args) {

    String name = "pi_username";

        String password = "pi_password";

    String authString = name + ":" + password;

        String authStringEnc = new BASE64Encoder().encode(authString.getBytes());

        System.out.println("Auth string: " + authStringEnc);

        String line;

        StringBuffer jsonString = new StringBuffer();

        try {

            URL url = new URL("http://your_PI_domain:50000/RESTAdapter/riesgosput/1234");

            //escape the double quotes in json string

            String payload="{\"nmDni\":\"71333\"}";

            HttpURLConnection connection = (HttpURLConnection) url.openConnection();




            connection.setRequestProperty("Authorization", "Basic "+authStringEnc);

            connection.setRequestProperty("Accept", "application/json");

            connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8");


            OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream(), "UTF-8");



            BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));

            while ((line = br.readLine()) != null) {





        } catch (Exception e) {

                throw new RuntimeException(e.getMessage());



        System.out.println("Respuesta: "+jsonString.toString());





In the PI message monitor you will see the 2 lines for each test.  And if you open the message you will see in the Payload tab the JSON message:

I hope this helps in your way to test the RESTAdapter in PI.

Have a good day

Labels in this area