-
Notifications
You must be signed in to change notification settings - Fork 57
Basic authorization on createClient call #98
Description
Hi Luca,
first of all, thanks for your work with this library.
I'm trying to access to a WSDL that requires basic authorization. I added a wsdl header for do it, but don't work. If I look the request that browser sends to server, doesn't have the authorizathion header.
this.soap.createClient('http://spolsapt50:8000/sap/bc/srt/wsdl/flv_10002A111AD1/srvc_url/sap/bc/srt/rfc/sap/z_sga_get_menu',
{wsdl_headers: {Authorization: `Basic ` + btoa('sc5301:xxxxxxxx')}})
.then(client => {
console.debug;
client.addHttpHeader('Authorization', 'Basic ' + btoa('sc5301:xxxxxxxx'));
})
.catch(err => {
console.log('Error', err);
});
I've debuged the call to createClient and I saw this code (I've deleted some commented lines):
function open_wsdl(uri, options) {
return __awaiter(this, void 0, void 0, function* () {
// initialize cache when calling open_wsdl directly
let WSDL_CACHE = options.WSDL_CACHE || {};
let request_headers = options.wsdl_headers;
let request_options = options.wsdl_options;
const httpClient = options.httpClient;
const wsdlDef = yield httpClient.get(uri, { responseType: 'text' }).toPromise();
const wsdlObj = yield new Promise((resolve) => {
const wsdl = new WSDL(wsdlDef, uri, options);
WSDL_CACHE[uri] = wsdl;
wsdl.WSDL_CACHE = WSDL_CACHE;
wsdl.onReady(resolve(wsdl));
});
return wsdlObj;
});
I saw that http request is sent in "const wsdlDef = yield httpClient.get(uri, { responseType: 'text' }).toPromise();" line, but in this line options parameter is not used. This call already returns a 401 error.
Any idea? Is this behavior normal?
I tried to customize your module with your instructions in https://github.com/lula/ngx-soap#local-development, but "npm install" throws this error .
C:\App\ngx-soap>npm install
> node-sass@4.9.1 install C:\App\ngx-soap\node_modules\node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.9.1/win32-x64-83_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.9.1/win32-x64-83_binding.node":
HTTP error 404 Not Found
I'm a little frustrated, all my intents go wrong, could you help me?
Thanks in advance!!