Запрос SOAP / AXL к CUCM терпит неудачу с Node.js

1

Все,

Спасибо, что нашли момент, чтобы проверить этот вопрос. Любая помощь приветствуется, поскольку я новичок.

Я пытаюсь работать с Node.js, чтобы сделать SOAP/AXL-вызов для v11.5 Cisco Callmanager. Я скопировал код из этого блога человека, который имеет действительно удивительное объяснение: http://blog.darrenparkinson.uk/2014/04/accessing-cisco-administrative-xml-axl.html

Я проверил, что у пользователя есть разрешения AXL и что служба AXL включена в CAllmanager. Я могу успешно запустить тот же вызов SOAP/AXL с тем же Callmanager с теми же учетными данными, что и с помощью SoapUI.

Однако, когда я запускаю это, я получаю ошибку http.599. У меня есть смешное чувство, что это имеет какое-то отношение к безопасности, но я не могу на нее наложить.

Вот мой код.

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 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);
});
Теги:
soap
cucm
cisco-axl

1 ответ

2
Лучший ответ

Я смог заставить ваш код работать, выполнив следующие два изменения:

  • строка 5, AXL придирчив к формату значения SOAPAction:

    'SOAPAction':'"CUCM:DB ver=11.5 listCss"',

  • строка 10, пространство имен XML, определенное в огибающей ("axl"), не соответствовало пространству имен, используемому в запросе ("ns")

    var soapBody = new Buffer('<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/11.5">' +

  • 0
    Вы, сэр, потрясающие! Это работает как шарм. Спасибо, что поставил меня на прямую и узкую и заставил меня думать, что это аутентификация. Спасибо, что нашли время, чтобы помочь мне!

Ещё вопросы

Сообщество Overcoder
Наверх
Меню