javascriptnode.jssoapcisco-axlcucm

SOAP/AXL Request to CUCM Fails with Node.js


All,

Thanks for taking a moment to check out this question. Any help is appreciated as I'm a beginner.

I am trying to work with Node.js to make a SOAP/AXL call over to a v11.5 Cisco Callmanager. I have copied the code from this person blog which has a really awesome explanation: http://blog.darrenparkinson.uk/2014/04/accessing-cisco-administrative-xml-axl.html

I have verified that the user has AXL permissions and that the AXL service is enabled on the CAllmanager. I am able to successfully run the same SOAP/AXL call against the same Callmanager with the same credentials using SoapUI successfully.

However, when I run this I get an http.599 error back. I've got a funny feeling it has something to do with the security, but I can't put my finger on it.

Here is my code.

var https = require("https");
var authentication = 'username:password';

var headers = {
  'SoapAction':'CUCM:DB ver=11.5',
  'Authorization': 'Basic ' + new Buffer(authentication).toString('base64'),
  'Content-Type': 'text/xml; charset=utf-8'
}

var soapBody = new Buffer('<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:axl="http://www.cisco.com/AXL/API/11.5">' +
'<soapenv:Header/>' +
  '<soapenv:Body>' +
   '<ns:listCss sequence="?">' +
      '<searchCriteria>' +
         '<name>%</name>' +
      '</searchCriteria>' +
      '<returnedTags uuid="?">' +
         '<name>?</name>' +
         '<description>?</description>' +
         '<clause>?</clause>' +
      '</returnedTags>' +
   '</ns:listCss>' +
'</soapenv:Body>' +
'</soapenv:Envelope>');


var options = {
  host: '192.168.204.10',     // The IP Address of the Communications Manager Server
  port: 8443,                 // Clearly port 443 for SSL -- I think it's the default so could be removed
  path: '/axl/',              // This is the URL for accessing axl on the server
  method: 'POST',             // AXL Requires POST messages
  headers: headers,           // using the headers we specified earlier
  rejectUnauthorized: false   // required to accept self-signed certificate
};

// Doesn't seem to need this line, but it might be useful anyway for pooling?
options.agent = new https.Agent(options);

var req = https.request(options, function(res) {
  console.log("status code = ", res.statusCode);
  console.log("headers = " , res.headers);
  res.setEncoding('utf8');
  res.on('data', function(d) {
    console.log("Got Data: " + d);
  });
});

req.write(soapBody);
req.end();
req.on('error', function(e) {
  console.error(e);
});

Solution

  • I was able to get your code working by making the following two changes: