strong-soap returning undefined property

39 Views Asked by At

I've an API i'm currently trying to get the response from. However, it seems to return unidentified although the request seems correct.

This is what curl gives that is currently working.

curl --location 'https://openweb.nlb.gov.sg/OWS/CatalogueService.svc' \
--header 'Content-Type: text/xml; charset=utf-8' \
--header 'SOAPAction: http://www.nlb.gov.sg/ws/CatalogueService/ICatalogueService/GetTitleDetails' \
--data '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <wsse:Security soap:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"/>
  </soap:Header>
  <soap:Body>
    <GetTitleDetailsRequest xmlns="http://www.nlb.gov.sg/ws/CatalogueService">
      <APIKey>string</APIKey>
      <BID>string</BID>
      <ISBN>string</ISBN>
    </GetTitleDetailsRequest>
  </soap:Body>
</soap:Envelope>
'

However, when i tried using strong-soap. It says Cannot read properties of undefined (reading 'CatalogueService')

var soap = require('strong-soap').soap;
const url = 'https://openweb.nlb.gov.sg/OWS/CatalogueService.svc';

var requestArgs = {
    APIKey: 'redacted',
    BID: '',
    ISBN: '0062433652',
};
var options = {};

soap.createClient(url, options, function (err, client) {
    var method = client['CatalogueService']['ICatalogueService']['GetTitleDetails'];
    method(requestArgs, function (err, result, envelope, soapHeader) {
        console.log(soapHeader);
        //response envelope
        console.log('Response Envelope: \n' + envelope);
        //'result' is the response body
        console.log('Result: \n' + JSON.stringify(result));
    });
})
0

There are 0 best solutions below