xmlrpc
Provides an easy to use XML-RPC implementation.
module exceptions
- InvalidServerResponse - Exception thrown if a server did not respond with response status 200 (OK).
- MalformedXmlRpc - Exception thrown if an XML-RPC response is not well formed.
- Fault - Exception thrown if the RPC response is a Fault.
- Fault::faultCode - The fault code returned by the rpc call.
- Fault::faultString - The fault string returned by the rpc call.
module methods
- marshall(obj) - Marshalls an object to XML-RPC.(Converts an object into XML-RPC conforming xml.) It just calls the toXmlRpc function of the objcect. So, to customize serialization of objects one just needs to specify/override the toXmlRpc method which should return an xml string conforming with XML-RPC spec.
- obj - The object to marshall
- returns An xml representation of the object.
- unmarshall(xml) - Unmarshalls an XML document to a JavaScript object. (Converts xml to JavaScript object.) It parses the xml source and creates a JavaScript object.
- xml - The xml document source to unmarshall.
- returns The JavaScript object created from the XML.
- unmarshallDoc(doc, xml) - Unmarshalls an XML document to a JavaScript object like unmarshall but expects a DOM document as parameter. It parses the xml source and creates a JavaScript object.
- doc - The xml document(DOM compatible) to unmarshall.
- returns The JavaScript object created from the XML.
module classes
- ServiceProxy(url,methodNames,user,pass) - Class for creating proxy objects which resemble the remote service. Method calls to this proxy will result in calls to the remote service.
The arguments are interpreted as shown in the examples:
ServerProxy("url")
ServerProxy("url", ["methodName1",...])
ServerProxy("url", ["methodName1",...], "user", "pass")
ServerProxy("url", "user", "pass")
- url - The url of the service.
- methodNames =[] - Array of names of methods that can be called on the server. If no methods are given then introspection is used to get the methodnames from the server.
- user = null - The user name to use for HTTP authentication.
- pass = null - The password to use for HTTP authentication.
The ServiceProxy? objects expose all the methods of the remote service as XMLRPCMethod objects. In addition the object also has the following methods and properties.
- ServiceProxy::_addMethodNames(methodNames) - Adds new XMLRPCMethods to the proxy server which can then be invoked.
- methodNames - Array of names of methods that can be called on the server.
- ServiceProxy::_setAuthentication(user,pass) - Sets username and password for HTTP Authentication for all methods of this service.
- user - The user name.
- pass - The password.
- ServiceProxy::_introspect() - Initiate XML-RPC introspection to retrieve methodnames from the server and add them to the server proxy.
- ServiceProxy::_url - The url of the service to resemble.
- ServiceProxy::_user - The user used for HTTP authentication.
- ServiceProxy::_password - The password used for HTTP authentication.
- ServiceProxy::_methods - All XMLRPCMethod objects the proxy can call.
- XMLRPCMethod(url, name, user, pass) - Class for creating XML-RPC methods. Calling the created method will result in an XML-RPC call to the service. The return value of this call will be the return value of the RPC call.RPC-Faults will be raised as Exceptions.
- url - The URL of the service providing the method.
- name - The name of the method to invoke.
- user = null - The user name to use for HTTP authentication.
- pass = null - The password to use for HTTP authentication.
Asynchronous operation: If the last parameter passed to the method is an XMLRPCAsyncCallback object, then the remote method will be called asynchronously. The results and errors are passed to the callback.
- XMLRPCMethod::toMulticall() - Returns the method representation for system.multicall.
- All params will be passed to the remote method.
- returns An object containing a member methodName and a member params(As required by system.multicall).
- XMLRPCMethod::setAuthentication(user,pass) - Sets username and password for HTTP Authentication.
- user - The user name.
- pass - The password.
- XMLRPCMethod::methodName - The name of the remote method.
- XMLRPCMethod::url - The url of the remote service containing the method.
- XMLRPCMethod::user - The user name used for HTTP authorization.
- XMLRPCMethod::password - The password used for HTTP authorization.
module interfaces
- XMLRPCAsyncCallback(result, err) - The interface of a callback for asynchronous XML-RPC.
- result - The result of the call (null if error)
- err - The Fault if there was one returned otherwise null
dependencies
documentation/urllib is required for making the HTTP request to the remote service. documentation/xml is required for xml parsing.
