Drafts Script Reference

XMLRPC

The XMLRPC object is a convenience method to provide an easy way to XML-RPC web services. The request function takes care of converting native Javascript objects and values to the XML parameters required for the XML-RPC interface, and converts the XML responses returned to Javascript objects.

It will also return faults parsed to error messages in the response if necessary.

This object is suitable for communication with a number of popular XML-RPC interfaces, including the MetaWeblog API. WordPress also offers it’s own XML-RPC interface, which can be used via this object, or the convenience wrapper WordPress object.

Class functions

Examples

// DEMO of XML-RPC
// Calls example method on http://xml-rpc.net/index.html

let url = "http://www.cookcomputing.com/xmlrpcsamples/RPC2.ashx";
let methodName = "examples.getStateName";
let params = [20];

let response = XMLRPC.request(url, methodName, params);

if (response.success) {
	alert(JSON.stringify(response.params));
}
else {
	alert("Fault: " + response.faultCode + ", " + response.error);
	context.fail();
}