Connection Class
extends XML object
Public Properties
Server:String
Specifies the url of the XMLRPC service.
var rpc1 = XMLRPC.Connection();
rpc1 = XMLRPC.Server='http://www.myserver.com/xmlrpc';
Quiet:Boolean
When set to
true, Connection will trace little to no debug info.
var rpc1 = XMLRPC.Connection();
rpc1 = XMLRPC.Quiet=true;
Public Methods
constructor Connection([server:String])
The main class used for XMLRPC communication. As of now, it is the only class that needs to be accessed by the end-coder. It manages the XML creation, sending, and parsing.
var rpc1 = XMLRPC.Connection();
var rpc2 = XMLRPC.Connection('http://www.myserver.com');
AddParameter(param_value:Object [,param_type:String]):Boolean
Used to add arguments to your method call.
param_value can be type of data specified in the XMLRPC standard.
param_type specified what type of data us being passed in. Data type constants are in XMLRPC.types.
rpc1.AddParameter(['a','b','c'] ,XMLRPC.types.ARRAY);
Call(method:String):Boolean deprecated
Used to call remote method. Any arguments/parameters added via
AddParameter will be included in the call. This method is deprecated because remote methods can now be called directly on the
Connection instance.
//old way
rpc1.Call('getMenu');
//new way
rpc1.getMenu();
ClearParameters():Void
Clears method call arguments/parameters. This is a wrapper for Method.ClearParameters.
rpc1.ClearParameters();
IsLoaded():Boolean
Returns true if remote XML response has been loaded. Else, returns false.
rpc1.IsLoaded();
toString():String
Returns
String representation of
Connection object.
rpc1.ClearParameters();
Public Events
OnLoad:Void
User-defined function to be triggered when the XMLRPC response is loaded. The
OnLoad function is passed the result of the unmarshalled response, not the actual XML response.
function myOnLoad(response:Object){
trace("Server returned " + response);
}
rpc1.OnLoad=myOnLoad;
Example
var m = new XMLRPC.Connection('http://www.myspellchecker.com/xmlrpc');
m.AddParameter('vacum',XMLRPC.types.STRING);
m.OnLoad = function(response:Object){
trace('Server returned: ' + response);
}
m.spellCheck(); //call remote method directly on connection instance
Back to Main Page