Tintware Documentation : Tint Programming Language : Tint Reference : XML-RPC : xmlrpc.callSyntax#(xmlrpc.call,%endpoint,%method,%parameters) %endpoint is a dictionary specifying the XML-RPC server where the call should be directed. %method is the name of the procedure to execute on the server. %parameters is an array of arguments to be passed to the procedure. Example#(dict,ep,type,http,server,betty.userland.com,uri,/RPC2,port,80) #(array,args,12) #(args.1.attribute,integer) #(#(xmlrpc.call,ep,examples.getStateName,args)) EndpointsAn endpoint is a dictionary; it must have a field named type. The value of this field can be http or lrpc. If it is http, there must be additional fields named server, uri, and port. If it is lrpc, there must be one additional field named server. For example, here is how an lrpc endpoint for Tint Emacs is defined: #(dict,ep,type,lrpc,server,Tint Emacs). ParametersThe parameters are passed as an array. The first parameter is %parameters.1, the second parameter is %parameters.2, and so on. Simple types (string, integer, boolean, double, datetime, hex-binary, and base64-binary) are all specified as strings. To set the type of a string, use string.attribute. Complex types (array and struct) are specified using the equivalent Tint constructs: array and dict. The following is an example of how to setup the parameters for an XML-RPC call which takes two parameters, the first is an integer and the second is a struct with two fields, one (a double) and two (a boolean). #(array,params) #(def,params.1,193,integer) #(dict,params.2) #(def,params.2.one,98.587,double) #(def,params.2.two,0,boolean) Resultxmlrpc.call returns the name of an object (string, array, or dict) if the call was successful; otherwise, $.error contains error information. If the result is a string, it can be called to get the value. This was done above in the first example: #(#(xmlrpc.call,...)). If you are not sure of the return type, use tint.type to determine it. |