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
Response like: Afghanistan
while test it, Why it shows that error? Any one please help me out from this issue,