Forum Discussion

Azar's avatar
Azar
New Contributor
8 months ago

Call external javascript function from Groovy in SoapUI

Hi, 

 

We have a requirement where we have to call an external javascript function within groovy script in SoapUI, This was possible from Java using :

ScriptEngine engine = new ScriptEngineManager().getEngineByName("javascript")
engine.eval(new FileReader(JAVA_SCRIPT_FILE_PATH))
Invocable invocable = (Invocable) engine
String result = invocable.invokeFunction(JAVA_SCRIPT_MAIN_METHOD, <Method Parameter List>)

 

However, same java code is not working in groovy and definitely itseems like something is missing here, Reaching out for any sort of help this community can provide here

 

Thanks in advance

6 Replies