Hi
Camunda 7.7
I have a simple process to test the http-connector:
The Output param Javascript is as follows (very verbose for debugging):
var resp = connector.getVariable(“response”)
print('resp ’ + resp);
var result = S(resp);
print('result ’ + result );
print('isString(): ’ + result.isString() );
print('isObject: ’ + result.isObject() );
var pv = result;
print('pv ’ + pv);
pv;
Result in the following in cockpit:
As you can see the type is ‘Json’ (wrong) and not ‘String’ and that is why it is highlighted in red above.
However, if i change the Javascript to:
…
var pv = result.stringValue();
…
I get and exception:
org.camunda.spin.json.SpinJsonDataFormatException: SPIN/JACKSON-JSON-01002 Expected ‘String’, got ‘OBJECT’
How can i return a value that is a String in cockpit?
The service return a string value in the entity:
@GET
@Path(“getTest/{param1}”)
public Response getTest(@PathParam(“param1”) String param1,
@QueryParam(“param2”) String param2){
System.out.println(param1 + " " + param2);
return Response.status(200).entity(“{"someKey" : "someValue"}”).build();
}
Log output:
resp {“someKey” : “someValue”}
result {“someKey”:“someValue”}
isString(): false
isObject: true
pv {“someKey”:“someValue”}