Helma logo
helma.org » Home > docs > reference > Remote Object

Remote Object

Object implementing an XML-RPC client.

XML-RPC is a simple framework to enable one machine to execute remote procedures on another using HTTP and XML.

In Helma such calls are performed using a Remote object. Remote objects are created with the URL of the XML-RPC service. Functions of the remote XML-RPC service then can be called just like local functions.

To compensate for the missing exception handling, Remote objects return result wrappers which contain either the result of the remote function, or a description of the error if one occurred.

Example
var xr = new Remote("http://helma.domain.tld:5056/");
var msg1 = xr.helmaorg.getXmlRpcMessage();
if (msg1.error)
   res.write(msg1.error);
else
   res.write(msg1.result);

Hello, Xml-Rpc World!

var msg2 = xr.hotelGuide.hotels.grandimperial.getXmlRpcMessage();
if (!msg2.error)
   res.write(msg2.result);

Welcome to the Grand Imperial Hotel, Vienna!

var msg3 = xr.kolin.document.comments["23"].getXmlRpcMessage();
if (!msg3.error)
   res.write(msg3.result);

Here you can write your comments.

var xr = new Remote("http://betty.userland.com/RPC2");
var state = xr.examples.getStateName(23);
if (!state.error)
   res.write(state.result);

Minnesota


Up: Reference
Previous: Application Object Next: Path Object

... comment


Page last modified on 2002-09-16 16:10 by czv