Skip to content
Admin Aug 22, 2022 10:00:39 AM 1 min read

What is xmlrpc?

It's a spec and a set of implementations that allow software running on disparate operating systems, running in different environments to make procedure calls over the Internet.

It's remote procedure calling using HTTP as the transport and XML as the encoding. XML-RPC is designed to be as simple as possible, while allowing complex data structures to be transmitted, processed and returned.

JavaScript implementation

Starting in 2019, there's a new implementation of XML-RPC in JavaScript.

  • Client and server for Node.js.

  • Client for the browser.

  • Pure JavaScript.

  • Supports XML and JSON encoding.

  • New debugger and validation suite.

  • Example code.

  • Written by one of the designers of the protocol.

Example client

Here's code that makes a simple XML-RPC call in a Node.js app.

const xmlrpc = require ("davexmlrpc");

const urlEndpoint = "";
const verb = "examples.getStateName";
const params = [5]; //an array containing one element, the number 5
const format = "xml"; //could also be "json"

xmlrpc.client (urlEndpoint, verb, params, format, function (err, data) {
if (err) {
console.log ("err.message == " + err.message);
else {
console.log (JSON.stringify (data));

It sends a call to the demo server,

The procedure it calls is "examples.getStateName," with a single parameter, the number 5.

The call will be made in XML (it could also use JSON if we know the server supports it).

When the server returns, the callback receives the standard Node error object in the first param, and if there was no error, the data returned through XML-RPC in the second parameter.

Example server

Here's the code for a simple XML-RPC server.

const xmlrpc = require ("davexmlrpc");

var config = {
port: 1417,
xmlRpcPath: "/rpc2"

xmlrpc.startServerOverHttp (config, function (request) {
switch (request.verb) {
case "uppercase":
if (request.params.length > 0) {
request.returnVal (undefined, request.params [0].toUpperCase ());
else {
request.returnVal ({message: "There must be at least one parameter."});
return (true); //we handled it
return (false); //we didn't handle it

Here's pseudo-code that calls this service. It returns THIS IS A TEST.

["xmlrpc://localhost:1417/rpc2"].uppercase ("this is a test")