Skip to content

Instantly share code, notes, and snippets.

@rifhanakram
Last active April 15, 2020 18:35
Show Gist options
  • Save rifhanakram/8fb5631e958067508679d946d69203a8 to your computer and use it in GitHub Desktop.
Save rifhanakram/8fb5631e958067508679d946d69203a8 to your computer and use it in GitHub Desktop.
Boligmappa SOAP API 2.0 Integration Example in Nodejs

Installation Guide

  • copy file into a new directory

Dependency Installation and Setup

  • yarn init
  • yarn add soap

Execution

  • node index.js

Expected Result

{ 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);
})
@rifhanakram
Copy link
Author

Make sure to update UserName and Password in the soap header

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment