Registry / http-networking / xmlrpc

xmlrpc

JSON →
library1.3.2jsnpmunverified

The `xmlrpc` package provides a pure JavaScript implementation of an XML-RPC client and server for Node.js environments. Its core differentiator is the exclusive use of JavaScript libraries for XML parsing (via `sax-js`) and XML building (via `xmlbuilder`), thereby avoiding native C dependencies and their associated build requirements. This allows developers to set up XML-RPC communication without needing a C compiler or specific system libraries. The package supports both client and server roles, enabling applications to make and receive XML-RPC method calls. Key features include configurable ISO 8601 date/time formatting for both encoding and decoding, and optional support for HTTP cookies to maintain session state. The latest stable version is 1.3.2, released in June 2016. Due to its age, it exhibits an effectively abandoned release cadence, with no updates in nearly a decade.

npm install xmlrpc
INSTALL
IMPORT
SIG · XMLRPC
X
xmlrpc
http-networkingjavascriptv1.3.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

xmlrpc
const xmlrpc = require('xmlrpc')
import xmlrpc from 'xmlrpc'
This package is CommonJS-only. Direct ES module `import` syntax will fail.
createServer
const server = xmlrpc.createServer({ host: 'localhost', port: 9090 })
import { createServer } from 'xmlrpc'
Accessed as a method of the default `xmlrpc` export; not a named export.
createClient
const client = xmlrpc.createClient({ host: 'localhost', port: 9090, path: '/' })
import { createClient } from 'xmlrpc'
Accessed as a method of the default `xmlrpc` export; not a named export.

This example demonstrates how to set up both an XML-RPC server and client, allowing them to communicate locally. It registers a server method 'anAction' and then uses the client to invoke it, showcasing basic call and response patterns.

const xmlrpc = require('xmlrpc'); // Creates an XML-RPC server to listen to XML-RPC method calls const server = xmlrpc.createServer({ host: 'localhost', port: 9090 }); // Handle methods not found server.on('NotFound', function(method, params) { console.log('Method ' + method + ' does not exist'); }); // Handle method calls by listening for events with the method call name server.on('anAction', function (err, params, callback) { console.log('Method call params for \'anAction\': ' + params); // ...perform an action... // Send a method response with a value callback(null, 'aResult'); }); console.log('XML-RPC server listening on port 9090'); // Waits briefly to give the XML-RPC server time to start up and start // listening setTimeout(function () { // Creates an XML-RPC client. Passes the host information on where to // make the XML-RPC calls. const client = xmlrpc.createClient({ host: 'localhost', port: 9090, path: '/'}); // Sends a method call to the XML-RPC server client.methodCall('anAction', ['aParam'], function (error, value) { // Results of the method response console.log('Method response for \'anAction\': ' + value); }); }, 1000);
Debug
Known issues
gotchaThe `xmlrpc` package has not been updated since June 2016 (v1.3.2). This signifies a lack of active maintenance, posing compatibility risks with modern Node.js versions (e.g., ESM, current HTTP standards), potential unpatched security vulnerabilities in its own code or its `sax` and `xmlbuilder` dependencies, and general instability when integrated into contemporary applications.
fix
Evaluate actively maintained alternatives for XML-RPC communication or thoroughly audit the code and its dependencies for security and compatibility issues if you must use this package. Consider using a compatibility layer for CommonJS in ESM projects.
affects: >=1.3.2
breakingSupport for Node.js v0.8 was explicitly dropped in version 1.3.2. Applications running on very old Node.js environments may encounter issues or require a downgrade to an earlier `xmlrpc` version.
fix
Upgrade your Node.js runtime to a more recent, supported version (e.g., Node.js v6.x or newer as supported by the last release).
affects: >=1.3.2
gotchaThis package is a CommonJS module and does not natively support ES module `import` syntax. Attempting to use `import xmlrpc from 'xmlrpc'` in a pure ESM context will result in a runtime error.
fix
Always use `const xmlrpc = require('xmlrpc');` for importing the module. If working in an ESM-only project, you might need to use a bundler or a wrapper to consume CommonJS modules.
affects: >=1.0.0
gotchaThe underlying XML builder library (`xmlbuilder`) saw significant version updates across `xmlrpc` releases (e.g., v2.4 to v8.2). While `xmlrpc` aims to abstract this, large jumps in internal dependency versions can sometimes introduce subtle changes in XML output or parsing behavior, particularly with edge cases.
fix
Thoroughly test XML payloads and parsing logic when upgrading `xmlrpc` across major minor versions to ensure consistent behavior, especially if you rely on specific XML structuring or attribute ordering.
affects: >=1.3.0
Errors
Common errors & fixes
SyntaxError: Cannot use import statement outside a module
Attempting to use ES module `import` syntax to load the CommonJS-only `xmlrpc` package.
fix
Change your import statement to `const xmlrpc = require('xmlrpc');`.
Method 'yourMethodName' does not exist
The XML-RPC server received a method call for which no corresponding event listener was registered using `server.on('methodName', ...)`.
fix
Ensure that `server.on('methodName', function(err, params, callback){...})` is defined for every method the server is expected to handle. Implement a `server.on('NotFound', ...)` handler for debugging unhandled method calls.
Date/Time format mismatch or parsing errors in XML-RPC communication.
The default ISO 8601 date formatting used by `xmlrpc` for encoding does not match the specific variant expected by the receiving XML-RPC endpoint, or vice-versa.
fix
Use `xmlrpc.dateFormatter.setOpts(options)` to precisely configure the date encoding options (e.g., `colons`, `hyphens`, `local`, `ms`, `offset`) to match the requirements of your XML-RPC communication partners.
Upgrade
Version history
1.3.2latest on npm
Audit
Dependencies
saxrequiredUsed internally for XML parsing.
xmlbuilderrequiredUsed internally for XML document construction.
Agent activity
30 hits · last 30 days
node
26
OpenAI (training)
1
Resources
xmlrpc — npm install xmlrpc · libregistry