2

I am trying to access data from RESTAPI using groovy code where i am getting error as below:

groovy.lang.MissingMethodException: No signature of method: java.lang.String.call() is applicable for argument types: () values: []
Possible solutions: wait(), chars(), any(), wait(long), take(int), tap(groovy.lang.Closure)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:70)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:182)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeClosure(ScriptBytecodeAdapter.java:586)

The error is coming mostly on the below part of the lines from code :

    String requestString = getRequestStringPrefix() + sb.toString()
    readHistory(authToken,ricMap,outFile)
    writeInstFile(outFile)

I am really new in the groovy coding and not understanding exactly the cause of the issue and how to resolve this issue in the code.

1 Answer 1

3

With this getRequestStringPrefix() you are calling a method with that name or as a shortcut a method call() on the underlying object, then it looks like getRequestStringPrefix.call().

I'm not sure what your intention was, but the line:

String requestString = getRequestStringPrefix() + sb.toString()

should look like

String requestString = getRequestStringPrefix + sb.toString()

because the variable getRequestStringPrefix (a strange name for a var) is defined as String further down:

String getRequestStringPrefix = """{
  "ExtractionRequest": {..."""
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.