- copy file into a new directory
- yarn init
- yarn add soap
- node index.js
{ Is_x0020_AvailableResult: true }
'use strict'; | |
var soap = require('soap'); | |
const url = 'https://testwebservice2.boligmappa.no/boligmappaapi.asmx?WSDL'; | |
const APP_NAME = "test"; // your applications name/tag | |
function createClient() { | |
return new Promise(function (resolve, reject) { | |
var options = { | |
disableCache: false | |
}; | |
soap.createClient(url, options, function (err, client) { | |
client.addSoapHeader({ | |
"UserAuthentication": { | |
"UserName": "", | |
"Password": "" | |
} | |
}, "", "tns", "http://webservice.boligmappa.no/BoligmappaApi.asmx"); | |
resolve(client); | |
}); | |
}); | |
} | |
function isAvailable() { | |
return new Promise(function (resolve, reject) { | |
createClient().then(function (bedriftIntegration) { | |
bedriftIntegration.IsAvailable({ | |
"applicationName": APP_NAME | |
}, function (err, result) { | |
if (err) { | |
reject(err); | |
} else { | |
resolve(result); | |
} | |
}); | |
}); | |
}); | |
} | |
isAvailable() | |
.then((success) => { | |
console.log(success); | |
}, (error) => { | |
console.log(error); | |
}) | |
Make sure to update UserName and Password in the soap header