Transactional Adapter

Transactional Adapter

Functionality

The Transaction adapter can be used to make a batch of diverse requests to a specific adapter. For example in order to send a ldapmodify together with an ldapmodifypassword requests this adapter can be used to send them in 1 go. If the adapter is transaction-aware (currently only jdbc) this will be done in a single transaction.

Prerequisites

A keystore is required in your TB_HOME in order to generate secure private keys. When adding the otp adapter via the gui the key is automatically added into the keystore.

Configuration

AdapterUniqueID

Unique name assigned to this adapter; the name is used to reference the adapter in the workflow. The ID has following requirements:

  • START with a letter or _ (underscore)
  • FOLLOWED by a combination of following characters: Letter, Number, '.' (dot), '-' (dash), '_' (underscore)
  • AdapterRef The ID of the adapter to be batched

Workflow Settings

A request for the adapter is prepared by specifying the following properties/scripts in the adapter activity:

  • Input Property: the variable containing the instructions the adapter have to execute
  • Output Property: the variable the adapter will store the response in after execution
  • Before Adapter Script: script that will be executed before calling the adapter
  • After Adapter Script: script that will be executed after the adapter fulfilled its task

Request - API

transactionalRequest

tb.transactionalRequest([request1,request2,...]); 

Response - API

Common Properties

The response API can be applied to the variable specified in the "output property" (see "Workflow Settings"): to verify whether the action performed by the adapter was successful, to query for the data returned by the adapter.

All responses have four properties in common:

  • status Status flag indicating whether the response is ok (0) or not (1).
  • substatus Response specific number indicating what the problem was, eg. http status code
  • message Response specific message in case there was a problem (can be null)
  • rc Return Code, a human readable code based on the substatus

Adapter Specific Properties

  • size Property containing the number of responses (normally the same as the number of requests)
  • getResponses() Function returning an array with all responses
  • getResponse(number) Function returning the n-th response

Response Codes

If all is ok, the status is zero, for non-zero statusses you can find the description below.

Examples

Example 1 : Generation

Request

tb.transactionalRequest([
    tb.ocspRequest('base64 of x509cert1'),
    tb.ocspRequest('base64 of x509cert2')
])

Response

function ldapwinadAfterSearch(workItem) {
    var returned = workItem.response;
    log(returned, "Aftersearch");
    if(returned.status == 0){ // all ocsp requests returned
        // do something else
    }
    else{
        for(var i = 0;i<returned.size;i++){
            var response = returned.getResponse(i);
            tb.log('Response '+i+' was '+response.status);
        }
    }
}
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.