I am trying to do Paymetric XiPay SOAP API integration using NodeJS. For this purpose I am using node-soap package.
After creating soapClient using this package I am setting the username and password on soapClient using its BasicAuthSecurity function.
My username has following value : 'domain\name', to escape the existing '\' the username is provided as follows : 'domain\\name'.
But when I try to use the client I got error message saying:
401 - Unauthorized: Access is denied due to invalid credentials.
After close inspection of my soapClient instance figured out that, the username property in soapClient has value 'domain\\name' not 'domain\name'.
So, how can I set a user name with single '\' for soapClient.
following is the code snippet I have written for this:
var soap = require('soap');
var xipay_serviceURL = 'https://qqq.xipaynet.com/aaa/bbb.asmx';
var xipay_user = "paymetric\\samplename";
var xipay_password = 'samplePassword*';
var wsdlURL = './XiPayWS3x.wsdl';
soap.createClient(wsdlURL, { endpoint: xipay_serviceURL }, function(err, client) {
if(err){
console.log(err);
return false;
}
if(client){
var security = new soap.BasicAuthSecurity(xipay_user, xipay_password);
client.setSecurity(security);
}
});
via Kharkooza Boche
No comments:
Post a Comment