From JRapid

Jump to: navigation, search

As defined by the wikipedia article, XML-RPC is a remote procedure call (RPC) protocol which uses XML to encode its calls and HTTP as a transport mechanism.

JRapid uses XML-RPC services to trigger execution of server side methods from the UI layer.


Executing XML-RPC with JavaScript

var xmlrpcserver = new JRapid_XmlRpcServer(jrapid.getURL(container) + '/xmlrpc');
xmlrpcserver.executeAsync('methodIdentifier', function(result, error) {}, params);

Register a New XML-RPC Service

Register the new service in the init() method of the MainController class of your application.

controller.registerXmlRpcService(SERVICES_CLASS.class, METHOD_NAME, SERVICE_IDENTIFIER);


Register the XML-RPC service in the MainController class.

controller.registerXmlRpcService(CompanyServices.class, "markAsInactive", "Company.markAsInactive");

In the CompanyServices class you implement the markAsInactve method.

public Boolean markAsInactive(String id) {
	Company company = Company.DAO().findById(id);
	return true;

And to make use of the service from the UI.

var xmlrpcserver = new JRapid_XmlRpcServer(jrapid.getURL(container) + 'xmlrpc');
xmlrpcserver.executeAsync('Company.markAsInactive', function(result, error) {}, company_id);

See also

Personal tools