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

Using AE_AJAX_SERVICE_UTIL Functions

Using AE_AJAX_SERVICE_UTIL Functions

The AE_AJAX_SERVICE_UTIL Javascript object (in
ae-avc-util.js
) has the following utility functions related to making JSON invokes:
  • getActiveVOSServiceURL
  • postJSON
getActiveVOSServiceUrl(serviceNamePath)
A helper function that creates the endpoint URL to the given service name by appending the service name to a predefined engine endpoint. The engine URL should be assigned (at the start of your script) to the global variable
AE_ACTIVEVOS_ENGINE_URL
. If a value to
AE_ACTIVEVOS_ENGINE_URL
is not assigned, then
http://localhost:8080/active-bpel
is used.
If a value is assigned to the global variable
AE_ACTIVEVOS_PROXY_URL
, then this function returns the proxy URL with service URL in the query string in a parameter named
destination
. See example below.
// Define engine context URL and optional proxy URL at the start of your script. // If the engine URL is not given, 'http://localhost:8080/active-bpel' is used. // Note: AE_ACTIVEVOS_ENGINE_URL is global variable declared in ae-avc-util.js. // You only need to assign it a value (to server /active-bpel context). AE_ACTIVEVOS_ENGINE_URL = "http://demoserver:81/active-bpel"; // Optionally, if you are using a proxy for AJAX requests, you can // assign it a value here: // AE_ACTIVEVOS_PROXY_URL = "http://localhost:8080/proxy"; // for example, JSON service URL. var loanServiceXmlUrl = AE_AJAX_SERVICE_UTIL.getActiveVOSServiceUrl("JSON/humantaskProcessDemoService"); // loanServiceXmlUrl is now equivalent to: // AE_ACTIVEVOS_ENGINE_URL + "/services/" + "JSON/humantaskProcessDemoService" // for example, // http://demoserver:81/active-bpel/JSON/humantaskProcessDemoService // If a value to AE_ACTIVEVOS_PROXY_URL is assigned, the 'loanServiceXmlUrl' becomes part of // the proxy URL string parameter named 'destination'. For example, // http://localhost:8080/proxy?destination=http://demoserver:81/active-bpel/JSON/humantaskProcessDemoService // For example, XML service URL. var loanServiceXmlUrl = AE_AJAX_SERVICE_UTIL.getActiveVOSServiceUrl("XML/humantaskProcessDemoService");
postJSON(aServiceUrl, aJsonData, aOnSuccessFn, aOnFaultFn, aOnErrorFn, aTimeOut)
Sends the JSON request to the server using HTTP POST and calls back with the JSON response. This function also handles error responses and callbacks either the JSON fault handler or the HTTP transport level error handler. Only the
aServiceUrl
and
aJsonData
are required.
var serviceUrl = "http://localhost:8080/active-bpel/JSON/humantaskProcessDemoService"; // or serviceUrl=AE_AJAX_SERVICE_UTIL.getActiveVOSServiceUrl("JSON/humantaskProcessDemoService"); // send JSON AE_AJAX_SERVICE_UTIL.postJSON( serviceUrl, // service url jsonRequest, // request JSON object function(aJsonResponse) { // success callback of JSON data // handle success response alert("Success!"); }, function(aJsonFault) { // fault callback of JSON data alert("Fault!"); }, function(aStatusCode, aStatusMessage) { // http error callback alert("Transport error: " + aStatusCode + " " + aStatusMessage); } );