Home »
Code Examples »
Groovy Code Examples
Groovy - Write log and to capture all payload in SAP CPI / Business Technology Platform Code Example
The code for Write log and to capture all payload in SAP CPI / Business Technology Platform
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("log1","Printing Payload As Attachment")
messageLog.addAttachmentAsString("log1",body,"text/plain");
}
return message;
}
Code by Reddy MS,
on February 7, 2023 13:20