I want to hit a rest web service using javascript code in script task . I am using Activiti rest but getting error XmlHttpRequest not found error. Can anyone here help.
var urlStream = url.openStream(); var reader = new BufferedReader(new InputStreamReader(urlStream, "latin1")); var html = ""; var line; while (line = reader.readLine()) { if (line == null) break; html += line; } var arr = JSON.parse(html); execution.setVariable("myVar", arr.id); print(arr.name); ]]> </script> </scriptTask>
<scriptTask id="scripttask1" name="Script Task" scriptFormat="javascript" activiti:autoStoreVariables="false"> <script> <![CDATA[ importPackage(java.io, java.net); var url = new URL('http://******/employee/service/v1.0/search/getEmployee?id=105');
var urlStream = url.openStream(); var reader = new BufferedReader(new InputStreamReader(urlStream, "latin1")); var html = ""; var line; while (line = reader.readLine()) { if (line == null) break; html += line; } var arr = JSON.parse(html); execution.setVariable("myVar", arr.id); print(arr.name); ]]>