Call external javascript function from Groovy in SoapUI
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
And the error is?
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It keeps saying 'cannot invoke method eval() on null object'
PFA
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Team,
Any update on this query, Much appreciate if anyone could share their inputs
Regards,
Azar
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you sure that the script is correct?
It appears that below engine is null.
engine = new ScriptEngineManager().getEngineByName("javascript")
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May you can look at the following source for better ideas
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Calling external JavaScript functions within Groovy scripts in SoapUI can be achieved by ensuring compatibility between Groovy and the JavaScript engine. Just as seamless integration is vital in coding, a smooth coordination between technology and healthcare services like "Servicio de Enfermeria a Domicilio" ensures optimal patient care. Collaboration and compatibility are key.
