Simple Cross-Network Scripting for Frontier

Starting in Frontier 8.0.4b2 (not yet released as of this writing), and Radio UserLand 8.0.4b2, a new feature makes it possible to make RPC calls via XML-RPC or SOAP, in a single line of UserTalk code.

This method of making remote procedure calls in Frontier is called SCNS, or Simple Cross Network Scripting.

This page explains how SCNS works, and demonstrates how Frontier can be used to call remote SOAP methods, in a single line of UserTalk code.

SCNS is supported by Frontier’s Tools framework, so you can create scripts that implement an SCNS syntax, for any protocol you need, by including a single script in a Tool.

How Simple Cross-Networking Scripting works in Frontier 

Here’s an example SCNS call for XML-RPC:

["xmlrpc://"].examples.getStateName (27)

The code above makes an XML-RPC request to the server named

The method it calls is named examples.getCurrentTime.

The call passes a single parameter — the number of a state, whose name you want.

Anatomy of an SCMS call 

One of the first things we wanted to do was to support multiple protocols, so we made sure that the SCNS syntax is supported by a driver structure.

For each built-in protocol, there’s a script at Frontier.protocols, which handles the protocol. For example, XML-RPC calls are handled by a script at Frontier.protocols.xmlrpc.

The name of the script that’s called corresponds to the protocol-part of the URL, in the first part of the identifier in the script call — in this case, xmlrpc://

The script at Frontier.protocols.xmlrpc takes three parameters:

1) The URL-part of the call. In the above example, the value of this parameter is xmlrpc://

2) The string-value of the dot-delimited path after the URL-part, up to the opening parenthesis. In the example above, examples.getStateName.

3) A record, containing the parameters to send with the RPC call.

Frontier.protocols.xmlrpc then parses the URL-part of the call, and then calls betty.rpc.client, with the server, port, path, and the address of the parameters, and returns the value that the remote XML-RPC server returns — in this case, a string which is the name of the state:


What about other protocols? 

There’s also a user.protocols table. Any script in this table whose name matches the protocol-part of the SCNS call, will be called first, and then Frontier/Radio will look in Frontier.protocols for the script. If not found in either place, then an error will be generated.

The user.protocols table allows you to extend or override the behavior of the SCNS framework: Let’s say, for example, that you want to make SCNS calls via SOAP:

First, create a script at user.protocols.soap. The script should take three parameters: rpcServer, procedureName, and paramRecord.

on soap (rpcServer, procedureName, paramRecord) {...}

Next, we have to do something with the parameters. First, we parse the server into its address, port, and path parts:

local (server, port = 80, path)<br /><br />