1. Home
  2. Libraries for webmasters
  3. Sending SOAP requests in the technology ‘Node.js’

Sending SOAP requests in the technology ‘Node.js’

The module ‘Node.js’ billon allows to send SOAP requests, which are available as methods of an object ‘call’ of an object ‘SoapService’, which is a parameter of the object ‘billon’ that can be obtained with the function ‘require’ with the value ‘billon’. The methods take arguments:

  • an object with parameters:
    • ‘WUI’ with API key, which can be obtained on the settings page of the service ‘billon.me’, or with an object with parameters ‘Name’ containing the username and ‘Address’ containing the address on which the application 24/7 listens for incoming requests,
    • ‘params’, whose value is the parameters of SOAP request in the form of an object;
  • function with arguments, which is the response of the application 24/7.

You can set an action after sending every SOAP operation globally setting the function ‘onRequestSend’ of the object ‘SoapService’ that is the parameter of the object ‘billon’. The function takes the same arguments as the function that is set with the configuration method ‘onRequestSend’, the name of the request, the parameters on an object form, the response and an error while sending in turn.

An example:

billon.SoapService.onRequestSend = function (requestName, parameters, requestResponse, error)
{ // the event of sending SOAP request, not required function assignment 
   console.log('SOAP request: ', requestName);
   console.log('Parameters of request: ', parameters);
   console.log('Response of the application 24/7: ', requestResponse);
   console.log('Error while sending: ', error);
var uniqueId = require('uuid/v1');
var data = {
    WUI: "eyJhkGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c3VyIjp7ImlkIjoyNSwic2FsdCI6IjEyZWVkMzQwLTM2NGUtMThNjgyN1hNDM5zA1MiOjEh0OTCJpYXQiDk0NjF9Q1M.zeWXG7Nyr3PFVhb4HRgLi5rh8fLZx41VHySHWUStIzc"); // API key of a user of the service 'billon.me', only the requests 'hello', 'requestPaymentInitiation', 'getTaskStatus', 'giveMoneyRequest' and 'startSeriesPayment'
    /*WUI: {
       Name: "billonpayments4",
       Address: ""
    });*/ // direct communication with application 24/7
    params: {
        type: "NORMAL",
        amount: {
            amount: 1000,
            currency: 'PLN'
        requestData: {
            username: 'paying',
            uniqueTransferId: uniqueId(),
            title: 'Payment title',
            merchantBrandName: 'Brand name',
            requestInvoiceData: "NOT_NEEDED",
            requestDeliveryData: "NOT_NEEDED",
            description: ' '
billon.SoapService.call.requestPaymentInitiation(data, function(requestResponse)
    if (requestResponse.requestStatus === "SUCCESS") 
Was this article helpful to you? Yes No

How can we help?