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 xmlrpcVerified import paths — ran on the pinned version, not inferred.
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.
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.
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).
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.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.
Change your import statement to `const xmlrpc = require('xmlrpc');`.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.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.