I wonder what is the best way to use xmlrpc with node.js, there is a npm plugin but I can't find how to use it. Thank you!
A piece of code from a working project:
const xmlrpc = require('xmlrpc');
const client = xmlrpc.createSecureClient({
host: 'yourhost'
port: 'yourport'
path: '/somepath'
});
function fetchData() {
return new Promise((resolve, reject) => {
const xmlData = {
table: 'GroupAssign',
limit: 1000,
page : 0,
};
return client.methodCall('DataService.query', [
xmlData.table,
xmlData.limit,
xmlData.page,
], (error, data) => {
if (error) { return reject(error); }
return resolve(data);
});
});
}
So you need to
xmlrpc
methodCall
with a method name as the first param