Skip to Content

Read data of Request Reply

Hi there, I'm new in SAP CPI. I'm using a Request Reply to connect to facebook and return some data. This works fine. My issue is how to read this data in my next step, a Groovy script. I can't find it. Thanks a lot.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Sep 09 at 04:35 AM

    Hi Claudio,

    Remember that, the message goes through every step of the whole Iflow, from sender to Receiver. In Groovy Script Step case, before Groovy Script Step, you will have the body message, if you want to read this "Message Body", you will have to capture the message body using:

    def body = message.getBody(java.lang.String) as String; (Use "def" sentences to define a variable)

    Check this example:

    import com.sap.gateway.ip.core.customdev.util.Message;

    import java.util.HashMap;

    def Message processData(Message message) {

    def body = message.getBody(java.lang.String) as String;

    def messageLog = messageLogFactory.getMessageLog(message);

    if(messageLog != null){

    messageLog.setStringProperty("Logging#1", "Printing Payload As Attachment") messageLog.addAttachmentAsString("ResponsePayload:", body, "text/plain");

    }

    return message;

    }

    Regards,

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 09 at 07:23 AM

    Hello Claudio,

    Good that you are able to get data from Facebook.What data your target system requires and what is your end goal after getting the data from Facebook.Based on this you can decide what steps needs to be used.

    Regards,

    Sriprasad Shivaram Bhat

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.