on 07-12-2018 5:25 PM
Hello Experts,
I need to extract fields from json payload using script, but when executing the script i getting below issue.
Error Details java.lang.NoSuchMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.getvalues() is applicable for argument types: (com.sap.gateway.ip.core.customdev.processor.MessageImpl) values: [com.sap.gateway.ip.core.customdev.processor.MessageImpl@b8cb74c] Possible solutions: getClass()
Below is the Groovy
Please help me.
Regards,Rajesh
Hi Rajesh
A couple of notes.
First off, have you possibly filled out the Script Function field with the value "getvalues"? If so, that's what your function should be called. Right now it's called processData (the default value). The Script Function field is this one:
Second, you need to import the Message class, for your script to work:
import com.sap.gateway.ip.core.customdev.util.Message
Third, when parsing the JSON body with JsonSlurper, you probably need to explicitly state that you want the message body returned as a String:
def body = message.getBody(java.lang.String)
def slurper = new JsonSlurper().parseText(body)
Let me know how it works out.
Regards,
Morten
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.