【问题标题】:SOAP/AXL Request to CUCM Fails with Node.js对 CUCM 的 SOAP/AXL 请求因 Node.js 失败
【发布时间】:2017-09-08 19:23:10
【问题描述】:

全部,

感谢您抽出时间查看此问题。由于我是初学者,因此感谢您提供任何帮助。

我正在尝试使用 Node.js 对 v11.5 Cisco Callmanager 进行 SOAP/AXL 调用。我从这个人的博客中复制了代码,其中有一个非常棒的解释:http://blog.darrenparkinson.uk/2014/04/accessing-cisco-administrative-xml-axl.html

我已验证用户具有 AXL 权限并且在 CAllmanager 上启用了 AXL 服务。我能够成功地使用 SoapUI 针对具有相同凭据的相同 Callmanager 成功运行相同的 SOAP/AXL 调用。

但是,当我运行它时,我得到一个 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'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);
});

【问题讨论】:

    标签: javascript node.js soap cisco-axl cucm


    【解决方案1】:

    通过进行以下两项更改,我能够让您的代码正常工作:

    • 第 5 行,AXL 对 SOAPAction 值的格式很挑剔:

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

    • 第 10 行,信封中定义的 XML 命名空间('axl')与请求中使用的命名空间('ns')不一致

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

    【讨论】:

    • 您,先生,太棒了!这就像一个魅力。感谢您让我直截了当,让我从认为这是身份验证中恢复过来。感谢您花时间帮助我!
    猜你喜欢
    • 2014-05-08
    • 1970-01-01
    • 2016-02-04
    • 1970-01-01
    • 1970-01-01
    • 2016-08-15
    • 1970-01-01
    • 2011-09-07
    • 2012-08-13
    相关资源
    最近更新 更多