1

In node-soap client, I have to remove xmlns:xsi and override xmlns:tns with xmlns:ser

I have tried a lot but unable to do so. Need Help

const url = 'http://host:9001/xyz/abc/something?wsdl';

var wsdlOptions = {
    "overrideRootElement": {
        "namespace": "ser"
    },
    "envelopeKey": "soapenv",
    "useEmptyTag": true,
    "ignoredNamespaces": {
        "namespaces": ['tns', 'xsi'],
        "override": true
      }
};

soap.createClient(url, wsdlOptions, async function (err, client) {
    if (err) {
        console.log(err)
    } else {
        var args = {
            AccountNo: '751600412147',
            PaymentSource:'SuvidhaPayment'
        };
        client.getConsumerEnquiryDetails(args, function (err, result) {
            if (err) {
                console.log(JSON.stringify(err, null, 2));
            } else {
                console.log(result);
            }
        }); 
    }
});

I expect the output to be like this

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:ser="http://service.collections.phoenix.com/">
    <soapenv:Body>
        <ser:getConsumerEnquiryDetails>
            <AccountNo>Mz9hvPk+osEI4MO3fiqbIA==</AccountNo>
            <PaymentSource>MlvdhUGnYrYyui0U1HcQYw==</PaymentSource>
        </ser:getConsumerEnquiryDetails>
    </soapenv:Body>
</soapenv:Envelope>

But I am getting this with xmlns:xsi and xmlns:tns(instead of xmlns:ser)

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://service.collections.phoenix.com/">
    <soapenv:Body>
        <ser:getConsumerEnquiryDetails>
            <AccountNo>Mz9hvPk+osEI4MO3fiqbIA==</AccountNo>
            <PaymentSource>MlvdhUGnYrYyui0U1HcQYw==</PaymentSource>
        </ser:getConsumerEnquiryDetails>
    </soapenv:Body>
</soapenv:Envelope>
k-kundan
  • 46
  • 6

0 Answers0