<%
include("/jagg/jagg.jag");
var log=new Log();
var ws = require("ws");

var startTask = function (taskId,endpoint) {

var version = new ws.WSRequest();
var options = new Array();
options.useSOAP = 1.2;
options.action = "http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803/start";
var cookie=session.get("workflowCookie");

options["HTTPHeaders"] = [
                              { name : "Cookie", value :cookie },
                        ];


var payload = '<ns:start xmlns:ns="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803">'+
'<ns:identifier>'+parseInt(taskId)+'</ns:identifier></ns:start>';
var result;
try {

version.open(options,endpoint, false);
version.send(payload);
result = version.responseE4X;
return {
error:false
};

}catch (e) {
log.error(e.toString());
return {
error:true
};

}
};
%>
