on ‎2017 Sep 11 7:28 PM
Hello,
I am trying to log payloads in an integration flow using the following code in a groovy script step:import com.sap.gateway.ip.core.customdev.util.Message;
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.addAttachmentAsString("Payload", body, "text/plain");
}
return message;
}
When executing the integration flow the following error appears in monitoring:
Message processing failed.
java.lang.NoSuchMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.Log message payload() is applicable for argument types: (com.sap.gateway.ip.core.customdev.processor.MessageImpl) values: [com.sap.gateway.ip.core.customdev.processor.MessageImpl@5b15080c]
Does anyone have an idea what is causing this or if there is a problem in the code itself?
Thank you for your help!
Request clarification before answering.
Hi Florian,
Can you please post a screenshot which shows the details of your Groovy script artifact?
This piece of code works for me:
import com.sap.gateway.ip.core.customdev.util.Message;
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("ResponsePayload1:", body, "text/plain");
}
return message;
}


Regards,
Prasanna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Make sure you leave the field Script Function blank, as per my earlier screenshot.
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.