Table of Contents

Search

  1. Preface
  2. Overview, Downloading, and Installing
  3. Administration API
  4. Identity Service API
  5. Screenflow Programming and SDK
  6. ActiveVOS WSHT API
  7. Embedding Request Forms in Standalone Web Pages
  8. XML-JSON for Process Central

APIs, SDKs, and Services

APIs, SDKs, and Services

WSHT API

WSHT API

The
AeTaskApi
class (in
ae-avc-tasks.js
script) can be used to access and operate on tasks. A few common functions are shown below. Refer to
AeTaskApi
in
ae-avc-tasks.js
for additional functions and details.
  • getTasks
  • getInstance
  • invokeSimpleWshtRequest
  • setOutput
getTasks(aGetTasksRequest, aSuccessCallbackFn, aFaultCallbackFn, aErrorCallbackFn)
Invokes the
getTasks
operation for Informatica-specific API extension at
AEB4P-aeTaskOperations
service. On success, the response callback returns the JSON equivalent of the
<htdt:getMyTasksResponse/>
element.
// Assign the server URL to AE_ACTIVEVOS_ENGINE_URL global variable. This is where // the service requests are sent. (note: AE_ACTIVEVOS_ENGINE_URL is global variable // declared in ae-avc-util.js.) AE_ACTIVEVOS_ENGINE_URL = "http://localhost:8080/active-bpel"; // create JSON request for getTasks operation. E.g. get upto 10 unclaimed tasks. var getTasksRequest = AE_TASK_UTIL.createGetTasksRequest( { taskType : AE_TASK_GLOBALS.GETMYTASKS_TASK_TYPE.TASKS, // same as string "TASKS" // same as string "POTENTIAL_OWNERS" genericHumanRole : AE_TASK_GLOBALS.GENERIC_HUMAN_ROLE.POTENTIAL_OWNERS, status : AE_TASK_GLOBALS.TASK_STATUS.READY, // "READY" maxTasks : 10 }); // Create AeTaskApi object and get the task list via getTasks() operation. var taskApi = new AeTaskApi(); taskApi.getTasks( getTasksRequest, // request JSON object function(aJsonResponse) { // success callback of JSON data // handle success response alert("Success!"); // get list of task abstracts (//htdt:getMyTasksResponse/htdt:taskAbstract) var jsonTaskAbstracts = AE_JSON_NODE_UTIL.getElements(aJsonResponse.getTasksResponse.getMyTasksResponse.taskAbstract); var i; for (i = 0; i < jsonTaskAbstracts.length; i++) { // wrap json data in AeTaskAbstract object for convenience accessors. // (see ae-avc-tasks.js for AeTaskAbstract) var taskAbstractObj = new AeTaskAbstract( jsonTaskAbstracts[i] ); alert( "Task id: " + taskAbstractObj.getId() ); alert( "Task name: " + taskAbstractObj.getName() ); alert( "Task status: " + taskAbstractObj.getStatus() ); } }, function(aJsonFault) { // fault callback of JSON data alert( "Fault!"); }, function(aStatusCode, aStatusMessage) { // http error callback alert( "Transport error: " + aStatusCode + " " + aStatusMessage); } );
getInstance(aTaskId, aSuccessCallbackFn, aFaultCallbackFn, aErrorCallbackFn)
Invokes the Informatica-specific
getInstance()
operation on the extension service at
AEB4P-aeTaskOperations
service. On success, the callback is an
AeTask
object (see
ae-avc-tasks.js
).
// ... // setup AE_ACTIVEVOS_ENGINE_URL, and the like // ... var taskApi = new AeTaskApi(); taskApi.getInstance( "urn:b4p:1235", // task ID function(aTask) { // handle success response // aTask is an instance of AeTask (see ae-avc-tasks.js). alert( "Got task, id=" + aTask.getId() ); alert( "Task name: " + aTask.getName() ); alert( "Task status: " + aTask.getStatus() ); // aTask.getJson() returns the underlying raw JSON data structer. // aTask.getOwner() returns current owner. var inputPartJson = aTask.getInput(); (// for input by partname, use aTask.getInput('nameOfPart'); }, function(aJsonFault) { alert("Fault!"); }, function(aStatusCode, aStatusMessage) { alert("Transport error: " + aStatusCode + " " + aStatusMessage); } );
invokeSimpleWshtRequest(aCommand, aTaskId, aSuccessCallbackFn, aFaultCallbackFn, aErrorCallbackFn)
Invokes a simple WSHT operation such as
claim
against the given task ID. The supported list of operation commands are defined in
AE_TASK_GLOBALS.SIMPLE_WSHT_OPERATIONS
constant.
var taskApi = new AeTaskApi(); var taskId = "urn:b4p:1234"; // claim taskApi.invokeSimpleWshtRequest( AE_TASK_GLOBALS.SIMPLE_WSHT_OPERATIONS.CLAIM, taskId, function(aClaimResponse) { // success (json data) }, function(aFaultResponse) { // fault (json data) }, function(aStatusCode, aStatusMessage) { //error } ); // start taskApi.invokeSimpleWshtRequest( AE_TASK_GLOBALS.SIMPLE_WSHT_OPERATIONS.START, taskId, function(aStartResponse) { // success (json data) }, // ... fault and error handlers omitted for brevity ... ); // complete taskApi.invokeSimpleWshtRequest( AE_TASK_GLOBALS.SIMPLE_WSHT_OPERATIONS.COMPLETE, taskId, function(aStartResponse) { // success (json data) }, // ... fault and error handlers omitted for brevity ... );
setOutput(aTaskId, aPartName, aOutputPart, aSuccessCallbackFn, aFaultCallbackFn, aErrorCallbackFn)
Sets the task output data given the task ID, the output part name, and the output JSON data:
var taskApi = new AeTaskApi(); var taskId = "urn:b4p:1234"; // message part name per wsdl var partName = "response"; // the <loan:loanApprovalResponse /> in JSON. var outputJson = {"loanApprovalResponse": { "xmlns": "http:\/\/schemas.active-endpoints.com\/avoscentral\/LoanRequest\/2009\/07\/avc-loanapproval.xsd", // other attributes and elements omitted for brevity. } }; // set output data taskApi.setOutput( taskId, partName, outputJson, function(aSetOutputResponse) { // success (json data) }, function(aFaultResponse) { // fault (json data) }, function(aStatusCode, aStatusMessage) { //error } );

0 COMMENTS

We’d like to hear from you!