Groovy script:
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import com.sap.it.api.mapping.*;
import java.text.SimpleDateFormat;
import java.util.Calendar;
def Message processData(Message message) {
map = message.getProperties();
property_ENABLE_PAYLOAD_LOGGING = "TRUE";
if (property_ENABLE_PAYLOAD_LOGGING.toUpperCase().equals("TRUE")) {
// def header = message.getHeaders() as String;
def body = message.getBody(java.lang.String) as String;
String timeStamp = new SimpleDateFormat("HH:mm:ss.SSS").format(new Date());
// String logTitleH = timeStamp + " Request Headers ";
String logTitleB = timeStamp + " Request Body ";
def messageLog = messageLogFactory.getMessageLog(message);
if (messageLog != null) {
// messageLog.addAttachmentAsString(logTitleH, header, "text/xml");
messageLog.addAttachmentAsString(logTitleB, body, "text/xml");
}
}
return message;
}
String timeStamp = new SimpleDateFormat("HH:mm:ss.SSS").format(new Date());
// String logTitleH = timeStamp + " Request Headers ";
String logTitleB = timeStamp + " Request Body ";
def messageLog = messageLogFactory.getMessageLog(message);
if (messageLog != null) {
// messageLog.addAttachmentAsString(logTitleH, header, "text/xml");
messageLog.addAttachmentAsString(logTitleB, body, "text/xml");
}
}
return message;
}
No comments:
Post a Comment