XML-RPC Request in JavaScript

35 views Asked by At

I have a very basic request. You can use the xml-rpc api from the german government to check the VAT-ID of companys if there company adress etc. is correct.

For the xml-rpc interface, they provide following information: https://evatr.bff-online.de/eVatR/xmlrpc/schnittstelle

How can I implement a basic request in JavaScript?

My initial approach:

const xmlrpc = require('xmlrpc');

const params = ['123','1234','company name','city','zipcode',"street"]; //example

const client = xmlrpc.createClient({ host: 'evatr.bff-online.de', port: 8000, path: '/evatrRPC' });

client.methodCall('evatrRPC', params, (error, value) => {
    if (error) {
      console.error('Fehler bei der Anfrage:', error);
    } else {
      console.log('Antwort:', value);
    }
  });

I get errors. For example using port 80: {errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '80.245.147.74', port: 80, …} For using different port like 8000: {errno: -4039, code: 'ETIMEDOUT', syscall: 'connect', address: '80.245.147.74', port: 8000, …}

0

There are 0 answers