IBM Worklight v5.0.5 > API reference > IBM Worklight client-side API > JavaScript client-side API

WL.Client.invokeProcedure

Invoke a procedure exposed by an IBM Worklight adapter

Parameter Description
invocationData A JSON block of parameters.
options Optional. A standard options object, augmented with the following property:

  • timeout: Integer. Number of milliseconds to wait for the server response before failing with a request timeout.

The success handler of this call receives an augmented response

The failure handler of this call is called in two cases:

  • The procedure was called but failed. In this case, the invocationResult property is added to the response received by the failure handler. This property has the same structure as the invocationResult property returned to the success handler, but the value of the isSuccessful attribute is false.

  • A technical failure resulted in the procedure not being called. In this case, the failure handler receives a standard response object.


WL.Client invokeProcedure JSON Parameter Block

WL.Client invokeProcedure function accepts the following JSON block of parameters:

{
    adapter : 'adapter-name',
    procedure : 'procedure-name',
    parameters : []
}

The JSON block contains the following properties:

Property Description
adapter Name of the adapter
procedure Name of the procedure
parameters Optional. An array of parameters passed to the back-end procedure.


WL.Client.invokeProcedure Success Handler Response Object

The success handler response object can contain the following properties:

Property Description
invocationContext The invocationContext object that was originally passed to the WL server in the callback object.
invocationResult An object that contains the data returned by the invoked procedure, and the invocation status. Its format is as follows:
invocationResult = 
{
    isSuccessful: Boolean,
    errors : "Error Message"
    // Procedure results go here
}

Where:

isSuccessful Contains true if the procedure invocation succeeded, false otherwise. If the invocation failed, the failure handler for the request is called.
errors An optional array of strings containing error messages.


Return Value

None.


Parent JavaScript client-side API