Interface RpcService
Provides access to RPC operations executed on the core or HTML services.
Methods list
Methods
executeRpc(rpcClass, rpcOperation, args)
Executes an asynchronous RPC operation on the server. This method instructs the ImageTrust server to load the specified implementing class and execute the specified operation, passing the provided arguments. This is an asynchronous operation, meaning the calling thread is not blocked until the operation completes. The operation returns a Promise and the actual result is delivered as the Promises resolution value when it arrives.
Arguments will be collected in an array and marshalled as a JSON array for transmission to the server so, ideally, they should be of types readily supported by JSON. For more complex types the client can serialize them as he wishes and pass strings to this method.
Similarily, the return value should be a string. The server RpcExecutor should stringify more complex types somehow (e.g. JSON) and the caller is responsible for deserializing.
Declaration
executeRpc(rpcClass: string, rpcOperation: string, ...args: any): Promise<string>;
Parameters
| Type | Name | Description |
|---|---|---|
| string | rpcClass | |
| string | rpcOperation | |
| any | args |
Returns
| Type | Description |
|---|---|
| Promise<string> |
executeRpcSync(rpcClass, rpcOperation, args)
Executes a synchronous RPC operation on the server. This method instructs the ImageTrust server to load the specified implementing class and execute the specified operation, passing the provided arguments. This is a synchronous operation, meaning the calling thread is blocked until the operation completes and the result is transmitted back to the ImageTrust client.
Arguments MUST be , so that their state can be serialized and transmitted to the server. If any of the arguments are of classes that are not provided by Java or ImageTrust, the classes MUST be present on the server, accompanying the implementation.
Any uploaded temporary files MUST be referred to by the unique IDs generated by the methods.
Declaration
executeRpcSync(rpcClass: string, rpcOperation: string, ...args: any): any;
Parameters
| Type | Name | Description |
|---|---|---|
| string | rpcClass | |
| string | rpcOperation | |
| any | args |
Returns
| Type | Description |
|---|---|
| any |
invokeOnServer(opName, params, pages)
Executes a method (operation) of a registered RPCExecutor on the server.
Declaration
invokeOnServer(opName: string, params?: string, pages?: TCPage | TCPage[]): Promise<any>;
Parameters
| Type | Name | Description |
|---|---|---|
| string | opName |
the name of the operation |
| string | params |
the parameters that will be passed to the operation. Normally a JSON-stringified object that may be parsed on the server and presented to the RPCExecutor as a Java object |
| TCPage | TCPage[] | pages |
a or a list of objects to be passed on to the operation. On the server, you are able to get a list of the images that are associated with these page objects. |
Returns
| Type | Description |
|---|---|
| Promise<any> | any return value returned from the server will be returned as the resolution value of the promise |
invokeOnServerWithBatch(opName, params)
Executes a method (operation) of a registered RPCExecutor on the server.
Declaration
invokeOnServerWithBatch(opName: string, params?: string): Promise<any>;
Parameters
| Type | Name | Description |
|---|---|---|
| string | opName |
the name of the operation |
| string | params |
the parameters that will be passed to the operation. Normally a JSON-stringified object that may be parsed on the server and presented to the RPCExecutor as a Java object. |
Returns
| Type | Description |
|---|---|
| Promise<any> | any return value returned from the server will be returned as the resolution value of the promise |