Setting Authorization in Node.js SOAP Client

前端 未结 5 1085
小鲜肉
小鲜肉 2020-12-16 02:31

I want to access a WSDL service through SOAP Client in Node.js. I used soap node module. But I can\'t able to find any documentation to set username and pas

5条回答
  •  悲哀的现实
    2020-12-16 03:15

    Another option to add basic authentication is using client.addHttpHeader. I tried both setSecurity and setting wsdl_headers but neither worked for me when authenticating to Cisco CUCM AXL.

    Here is what worked for me:

    var soap = require('soap');
    var url = 'AXLAPI.wsdl';  // Download this file and xsd files from cucm admin page
    var auth = "Basic " + new Buffer("your username" + ":" + "your password").toString("base64");
    soap.createClient(url,function(err,client){
      client.addHttpHeader('Authorization',auth);
    });
    

提交回复
热议问题