node-xmlrpc icon indicating copy to clipboard operation
node-xmlrpc copied to clipboard

trying XML RPC client with an https request

Open natoine opened this issue 7 years ago • 2 comments

Hi, I'd like to use your node xmlrpc module to make requests to a Odoo server http://www.odoo.com/documentation/10.0/api_integration.html

I've tried : const client = xmlrpc.createClient("https://[myOdooServer]/xmlrpc/2/common") client.methodCall('version ', [], function (error, value) { console.log('Method response for 'version': ' + value) })

And I've got the following error : http_client.js:55 throw new Error('Protocol "' + protocol + '" not supported. ' + ^ Error: Protocol "https:" not supported. Expected "http:"

Do I miss something or is this module not adapted for https requests ?

natoine avatar Aug 22 '17 20:08 natoine

you need to use:

const client = xmlrpc.createSecureClient("https://[myOdooServer]/xmlrpc/2/common")

(I also found that confusing)

grahamrhay avatar Sep 19 '17 16:09 grahamrhay

This one works for me (v15) enterprise:

username='admin'
password = 'admin'
db = 'demo_150_1641216360'
url = 'https://demo3.odoo.com'

const client = xmlrpc.createSecureClient(url+"/xmlrpc/2/common");
client.methodCall('version', [], function (error, value) {
  if (error){
    console.log('Error when calling a method: '+ error);
    return;
  }
  console.log('Method response for version: ', value);
});

client.methodCall('authenticate', [db, username, password, {}], function (error, uid) {
  if (error){
    console.log('Error when calling a method: '+ error);
    return;
  }
  console.log('uid:', uid);
});

bitsnaps avatar Jan 03 '22 16:01 bitsnaps