Page tree
Skip to end of metadata
Go to start of metadata

You can reference the original article submitted by John Jardin.

Quick Summary

Remote Services or RPC (Remote Procedure Call) allows you from Client-side JavaScript, to execute RPC functions that can trigger Server-side JavaScript or Java. You can also add a callback to the submission so that once it's complete, you can get a handle a on the result and continue processing your Client-side JavaScript code.

Below is a quick example of Client-side JavaScript calling a RPC function and passing a parameter to it:
var myObject = myRPC.RPCFunctionName("param1");
myObject.addCallback( function(result) {
	console.log(result);
});
Below is an example of the Remote Service Control and a RPC function that calls the actual SSJS Function:
<xe:jsonRpcService
	serviceName="myRPC"
	id="myRPC">
	<xe:this.methods>
		<xe:remoteMethod
			name="RPCFunctionName"
			script="SSJSFunctionName(param1);">
			<xe:this.arguments>
				<xe:remoteMethodArg
					name="param1">
				</xe:remoteMethodArg>
			</xe:this.arguments>
		</xe:remoteMethod>
	</xe:this.methods>
</xe:jsonRpcService>
The below SSJS function is triggered from the Remote Service and returns a result back to the CSJS Function
function SSJSFunctionName(param1){
	var result = param1 + " - Success";
	return result;
}

Detailed Overview

This is a video tutorial that shows you how to call Server-side JavaScript or Java from Client-side JavaScript using Remote Services. The beauty of using Remote Services is the ability to add a callback function, that allows you to continue operations in Client-side JavaScript once your Serve-side code has completed. You can even pass back a result from the backend to your Client-side code.

Step-by-step Guide

Important Notes

  • To run Remote Services in your XPage, you will need Notes and Domino version 8.5.2 or above, and you'll also need to install the 852 or above XPages Extension Library, which you can download from OpenNTF.
  • While this video was created in a Domino 8.5.2 environment, the basics still apply to this day.