Home

News

International

Screen Shots

Documentation

Download

Build

License

Credits

Contact

SourceForge Project

Tintware Documentation : Tint Programming Language : Tint Reference : XML-RPC : xmlrpc procedures

Defining XML-RPC Procedures

Any Tint procedure can be made remotely callable via XML-RPC by defining a string or procedure called xmlrpc as a child of the procedure to be remotely callable. If xmlrpc is a string, then the XML-RPC server will directly call the procedure. If xmlrpc is a procedure, then the XML-RPC server will call that procedure.

The parameters to the call will be an array. The name of this array will be passed as the only argument to whichever procedure gets called. The return value of the procedure must be the name of the object; this object will get returned to the remote caller.

Example

Here is an example of a procedure which adds two integers together and returns the result as an integer. The XML-RPC server will directly call add-integers because add-integers.xmlrpc is a string.

Def:Proc:add-integers(%args)
[*]
#(def,$.result,#(+,#(%args.1),#(%args.2)))
#($.result.attribute,integer)
$.result
[*]

Def:String:add-integers.xmlrpc
[*][*]

Another Example

Here is another example of a procedure which adds two integers. In this case it is an existing procedure which we want to make available for being remotely called via XML-RPC. The XML-RPC server will call add-integers.xmlrpc because it is a procedure; it will take care of calling add-integers with the proper arguments and converting the result into something that XML-RPC can use.

Def:Proc:add-integers(%x,%y)
[*]#(+,%x,%y)[*]

Def:Proc:add-integers.xmlrpc(%args)
[*]
#(def,$.result,#(add-integers,#(%args.1),#(%args.2)))
#($.result.attribute,integer)
$.result
[*]