The Payload does not seem to support the Map type, and you cannot seem to use script with JavaScript and generate something like: {“q”:“test one two three”}.
{“q”:“SELECT name, number FROM montreal_boroughs WHERE ST_Intersects(montreal_boroughs.the_geom,CDB_LatLng(45.508948,-73.554454))”}
Could Camunda provide some further documentation on how to create payloads that are KeyValues to be used in a POST payload?
Also for GET requests, the engine does not like non-friendly URL characters and the engine won’t convert into a proper format for the web.
The GET issue was resolved by using Inline javascript for the URL field. For future reference by anyone else looking at this, make sure to use the encodeURIComponent rather than just the encodeURI.: "https://stephenrussett.cartodb.com/api/v2/sql?q="+ encodeURIComponent ("SELECT name, number FROM montreal_boroughs WHERE ST_Intersects(montreal_boroughs.the_geom,CDB_LatLng(45.508948,-73.554454))");
Okay did some more testing. Unless there is a blatant mistake in my config for this simple example, the docs are incorrect or the payload parameter does not work.
I checked your process and indeed, it didn’t work with requestb.in, but it worked with hookbin.
I have uploaded a simple maven project with your process, which uses mockserver to intercept and verify the requests and they are send correctly. Run the project with mvn test and you can inspect the log output afterwards.
I changed your process so your requests run against mockserver and also added the header content-type: application/json for the POST request.
@hawky4s were you also able to get it to function with: “https://stephenrussett.cartodb.com/api/v2/sql?q=”+ encodeURIComponent (“SELECT name, number FROM montreal_boroughs WHERE ST_Intersects(montreal_boroughs.the_geom,CDB_LatLng(45.508948,-73.554454))”); ?
@hawky4s Thanks for the details. Looks like it was the Content-Type header that was causing the problem.
On a related note, I see if your parseresults.js code you reference connector. Is there a list of internal names for referencing different objects in Camunda?
On related note, this is what the final code example looked like; used inline Javascript for the Payload:
var lat = execution.getVariable("Latitude");
var long = execution.getVariable("Longitude");
'{"q":"SELECT name, number FROM montreal_boroughs WHERE ST_Intersects(montreal_boroughs.the_geom,CDB_LatLng(' + lat + ',' + long + '))"}';
Response was inline Javascript that parsed as: S(response).prop("rows").elements().get(0).prop("number").numberValue();
(in this example did not need to provide any error handling)
If you have better implementation suggestions, happy to receive.
If I am having a Url: “https://abc/xyz” and I will get a XML response from hitting it.
So for that what should be my http-connector configurations (Input and Output parameters) in the BPMN?
Now, in output Parameter of the Service Task I configured as follows to fetch “abc” from the XML
Name: myUrl
Type: Script
ScriptFormat: JavaScript
ScriptType: Inline Script
Script: var xml = S(response);
xmlName = xml.xPath("/product/categories[0]/code").element();
xmlName;
ERROR in TASKLIST:
Cannot instantiate process definition Hybris:38:d4b6fb29-a1ab-11e6-a73a-d43d7ec7ada1: Unable to evaluate script: sun.org.mozilla.javascript.internal.WrappedException: Wrapped org.camunda.spin.xml.SpinXPathException: SPIN/DOM-XML-01035 Unable to find XPath expression ‘/product/categories[0]/code’ (#2) in at line number 2
What exactly should I Write in SCRIPT to fetch abc???