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

7. APIs, SDKs, and Services

7. APIs, SDKs, and Services

Utility Functions

Utility Functions

Utility Functions
The
getMyTasks
example provided in the Invoking a Process with jQuery section (the full example is located in
json-getTasks.html
) demonstrated how to send a WSHT
getMyTasks
request to the server using
AE_AJAX_SERVICE_UTIL.postJSON()
utility function. The
ae-avc-tasks.js
script contains the
AE_TASK_UTIL
instance with the following convenience functions:
  • getFaultData
  • isFault
  • createGetTasksRequest
AE_TASK_UTIL.getFaultData(aJsonFault)
Returns an object
{faultName : "wshtFaultName", message : "faultMessageStr"}
or
null
if the
aJsonFault
is not a WSHT SOAP fault. The 'wshtFaultName' values are standard WSDL: illegalArgument, illegalAccess, illegalOperation, and recipientNotAllowed.
// code that handles fault due to a human task operation invoke. // check if this is a WSHT fault var faultData = AE_TASK_UTIL.getFaultData(aJsonFault); if (faultData != null) { // wsht fault. if (faultData.faultName == AE_TASK_GLOBALS.TASK_FAULT_NAMES.ILLEGAL_ARGUMENT) { alert("illegal arg fault: " + faultData.message); } } else { // system soap fault? var soapFaultData = AE_AJAX_SERVICE_UTIL.getSystemFault(aJsonFault); if (soapFaultData != null) { alert("SOAP fault. Fault name:" + soapFaultData.name + ", message:" + soapFaultData.message); } }
AE_TASK_UTIL.isFault(aJsonResponse)
Returns true if the JSON object
aJsonResponse
is a known WSHT fault (per WSDL).
AE_TASK_UTIL.createGetTasksRequest(aParams, aGetTasksTemplate)
Creates a generic request
getTasks
request and returns the JSON object. The params object contains the optional values. The options are:
  • taskType:
    one of the following strings: ALL, TASKS, or NOTIFICATIONS. The default is TASKS.
  • genericHumanRole:
    a string: generic human role such as potential owners.
  • status:
    a string or an array of strings for the task status (such as READY).
  • whereClause:
    a string
  • maxTasks:
    an integer: maximum number of tasks to retrieve. The default is 20.
  • taskIndexOffset:
    an integer: task list start offset index.
  • searchBy:
    search by string.
Provide a value of null to remove existing elements.
If the optional
aGetTasksTemplate
object, which is an existing JSON request, is given,
aGetTasksTemplate
is first cloned, and then the params are applied.
To create the following request:
<aeb:getTasks xmlns:aeb="http://schemas.active-endpoints.com/b4p/wshumantask/2007/10/aeb4p-task-state-wsdl.xsd" > <htdt:getMyTasks xmlns:htdt="http://www.example.org/WS-HT/api/xsd"> <htdt:taskType>TASKS</htdt:taskType> <htdt:genericHumanRole>POTENTIAL_OWNERS</htdt:genericHumanRole> <htdt:status>READY</htdt:status> <htdt:status>RESERVED</htdt:status> <htdt:maxTasks>5</htdt:maxTasks> </htdt:getMyTasks> <aeb:taskIndexOffset>0</aeb:taskIndexOffset> </aeb:getTasks>
Normally, you will need to create the JSON object:
var getTasksRequest = { "getTasks" : { "xmlns" : "http://schemas.active-endpoints.com/b4p/wshumantask/2007/10/aeb4p-task-state-wsdl.xsd", "getMyTasks" : { "xmlns" : "http://www.example.org/WS-HT/api/xsd", "taskType" : { "$t" : "TASKS" }, "genericHumanRole" : { "$t" : "POTENTIAL_OWNERS" }, "status" : [ {"$t" : "READY"} , {"$t" : "RESERVED"} ], "maxTasks" : { "$t" : "5"} }, "taskIndexOffset" : { "$t" : "0" } } }
With the
AE_TASK_UTIL.createGetTasksRequest()
function, the code to create the above request is:
var getTasksRequest = AE_TASK_UTIL.createGetTasksRequest( { taskType : "TASKS", genericHumanRole : "POTENTIAL_OWNERS", status : ["READY", "RESERVED"], maxTasks : 5, taskIndexOffset : 0 }); // getTasksRequest contains JSON for
<getTasks/>
element used // in
getTasks
operation for AE specific API extension at
AEB4P-aeTaskOperations
// service. // The WSHT getMyTasks request can be extracted in the following way: var wshtGetMyTasksRequest = { "getMyTasks" : getTasksRequest.getTasks.getMyTasks };