I also encountered this problem in the past. It is especially difficult for developers with experience using mostly RESTful APIs to get the basics of SOAP in a reasonable amount of time, not to mention the possibility of debugging problems in it. Keep in mind that SOAP uses the same application level protocol (HTTP) as the RESTful API that you are probably used to working with. There will be headers, uri, method, as well as what you are used to, the only thing that is especially important in how you format these fields.
After implementing this solution, I eventually came up with a few SOAP requests (I think it was two), I needed to use a SOAP tool for my desktop PC like SoapUI , and then just send these generated requests using a non-SOAP HTTP request library for node .
, :
var requestBody =
'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" ' +
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ><soap:Header>' +
'<SOAPAction>addRoom' +
'</SOAPAction></soap:Header><soap:Body><AddRoomRequest ' +
'xmlns="http://portal.vidyo.com/admin/v1_1"><room><name>' +
params.conferenceName + '</name><RoomType>Public</RoomType><ownerName>' +
vidyoApiUsername + '</ownerName>' + '<extension>' +
params.conferenceExtension +
'</extension><groupName>Default</groupName><RoomMode><isLocked>' +
'false</isLocked><hasPIN>false</hasPIN><hasModeratorPIN>false' +
'</hasModeratorPIN></RoomMode></room></AddRoomRequest></soap:Body>' +
'</soap:Envelope>';
var requestHeaders = {
'cache-control': 'no-cache',
'soapaction': 'addRoom',
'content-type': 'text/xml;charset=UTF-8'
};
var requestOptions = {
'method': 'POST',
'url': vidyoApiEndpoint,
'qs': { 'wsdl': ''},
'headers': requestHeaders,
'body': requestBody,
'timeout': 5000
};
request(requestOptions, function (error, response, body) {
if (error) {
} else {
try {
var parsingOptions = {
'object': true,
'sanitize': false
};
var jsonResult = parser.toJson(body, parsingOptions);
if(jsonResult['soapenv:Envelope']
['soapenv:Body']
['ns1:AddRoomResponse']
['ns1:OK'] === 'OK') {
conferenceInfo(req, res, next, params);
} else {
}
} catch (e) {
}
}
}).auth(vidyoApiUsername, vidyoApiPassword);
UPDATE: , , , SOAP . , , .