Using JSDOs to create mobile and web clients : Accessing custom Invoke operations
  

Accessing custom Invoke operations

In addition to the standard CRUD methods, you can call custom invocation methods on a JSDO that supports them. Each invocation method corresponds to a single routine on the server that is mapped depending on the type of Progress Data Object Service.
For an OpenEdge Data Object Service, each invocation method maps to a specific ABL routine that is implemented and defined in the Data Object resource to be called using an Invoke operation. For a Rollbase Data Object Service, each invocation method maps to a server-generated method that returns records from a Rollbase object that is related to the Data Object resource.
The Data Service Catalog identifies the available Invoke operations, with their corresponding custom JSDO method and server routine mappings. Calling an invocation method on the JSDO thereby causes the corresponding routine to execute on the server.
The signature of an OpenEdge ABL routine defined to implement an Invoke operation is largely unrestricted. All input and output parameters can use any ABL data types supported by OpenEdge Data Object Services. For more information, see OpenEdge ABL to JavaScript data type mappings.
The signatures of Rollbase server methods that are defined to implement Invoke operations conform to a common pattern used to return data with supported Rollbase types from a related object. For more information on the supported types, see Rollbase object to JavaScript data type mappings.
For an ABL implementation, the invocation method name can be the same as that of the ABL routine, or it can be an alias, as defined by the resource. The invocation method passes any ABL input parameters as properties of a single object parameter. The method returns results from the ABL routine, including any return value and output parameters, in the response property of a request object.
This response property references an object containing properties whose names match the names of output parameters defined in the ABL routine. Since JavaScript is case-sensitive, code that accesses the value of an output parameter must exactly match the name defined in the ABL routine. For user-defined functions and non-void ABL methods, the return value is available in the _retVal property of the response property object. This _retVal property also contains any error information returned by the server If the request fails.
For a Rollbase implementation, the Rollbase server determines the required mappings between invocation methods and their corresponding server implementaitons, and generates a Data Service Catalog accordingly. In this case, the _retVal property of the response property object always contains the related data that the method returns.
Note: For an OpenEdge implementation, JSDO memory is not automatically updated with the results of an Invoke operation. To add records returned by the Invoke operation to JSDO memory, call addRecords( ) on the appropriate table. For a Rollbase implementation, JSDO memory is only updated automatically with the related data returned by an Invoke operation when that Invoke operation functions as the Read operation for a given resource; othewise, you must use addRecords( ) on the JSDO created for the related resource to merge the returned data into its JSDO memory.
* Asynchronous vs. synchronous method execution
* Invoke operation example