exception- groovy connector : script is null
I'm using Bonita BPM Community Edition v.7.0 In my process, I made a service task and it has a connector. I used Groovy 2.4 connector to call external Restful service.
This restful service url return the response as { "RestResponse" : { "messages" : [ "More webservices are available at http://www.groupkt.com/post/f2129b88/services.htm", "Total [249] records found." ], "result" : [ { "name" : "Afghanistan", "alpha2_code" : "AF", "alpha3_code" : "AFG" }, { "name" : "Åland Islands", "alpha2_code" : "AX", "alpha3_code" : "ALA" }, { "name" : "Albania", "alpha2_code" : "AL", "alpha3_code" : "ALB" }, { "name" : "Algeria", "alpha2_code" : "DZ", "alpha3_code" : "DZA" } }}
When I test at the Edit expression window using 'Evaluate' button, it works well.BUT.. when I test using 'Test' button, it prints as follows.
java.lang.reflect.InvocationTargetException org.bonitasoft.engine.bpm.connector.ConnectorExecutionException: USERNAME=install | org.bonitasoft.engine.core.connector.exception.SConnectorException: org.bonitasoft.engine.connector.exception.SConnectorException: java.util.concurrent.ExecutionException: org.bonitasoft.engine.connector.exception.SConnectorValidationException: org.bonitasoft.engine.connector.ConnectorValidationException: Error validating connector org.bonitasoft.connectors.scripting.GroovyScriptConnector: The script is null.
My script is as follows,
`
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7' )
import groovyx.net.http.RESTClient
//import groovy.json.JsonSlurper
//import groovy.json.JsonOutput
def client = new RESTClient( 'http://services.groupkt.com' )
def resp = client.get( path : '/country/get/all' ) // ACME boomerang
assert resp.status == 200 // HTTP response code; 404 means not found, etc.
def value= resp.getData()
def value1 = value.RestResponse.result
return value1[0].name`
Result : Afghanistan
while test it, Why it shows that error? Any one please help me out from this issue,
Hi,
Not sure what the error is but in any case, there is a REST connector on the community: https://github.com/Bonitasoft-Community/bonita-connector-rest
You might want to take a look, that will probably be easier to use!
Cheers
Comments
A Tip on displaying CODE/LOGS correctly in Posts:
Do not use the Supplied Buttons above, for some reason they refuse to work correctly, and despite bringing it to Bonitasofts attention, it's low priority.
To Show Code/Logs correctly use
< code >
your code/log
< /code >
removing the spaces to allow the showing of code/logs correctly as here:
Thanks and regards
Seán