From script task, how to get an endpoint from a tenant?
could you please describe your question a bit more?
Yes, if you would like to call a REST endpoint form a groovy script, can you get the endpoint that is defined in the tenant somehow? Like the way you access process instance variables with execution.getVariable()?
The same endpoint definition that is used with REST call activity.
You can access Endpoint from script task like below.
I have tried with javascript.
java.lang.System.out.println(endpointService.getConfigurationByName("Demo").getHost());
Where can you find endpointService documentation?
org.activiti.engine.ActivitiException: problem evaluating script: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: endpointService for class: Script7
You need to unable script at below place.
process-services\tomcat\webapps\activiti-app\WEB-INF\classes\activiti\whitelisted-scripts.conf
You need to unable scripttask at like below.(activiti-app.properties)
validator.editor.bpmn.disable.scripttask=false
validator.editor.bpmn.disable.scripttask.groovy=false
beans.whitelisting.enabled=true
Yes, scripts and groovy have been enabled. The problem is that the runtime is unaware of endpointService. It needs to be defined somehow before calling. Referring to your other posts, it seems that you are injecting it with a bean. But is it your own mock implementation of EndpointService you are injecting or can you really access the endpoints defined in the tenant on Alfresco server runtime?
It is not mock implementation.
I am actually able to get endpoint which is defined i Tenant->Endpoints.
I have previously tried with groovy only. Now I tested your code and got this error:
jdk.nashorn.internal.runtime.ECMAException: ReferenceError: "endpointService" is not defined
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.