首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >对CUCM的SOAP/AXL请求在Node.js中失败

对CUCM的SOAP/AXL请求在Node.js中失败
EN

Stack Overflow用户
提问于 2017-09-08 19:23:10
回答 1查看 1.4K关注 0票数 1

全,

谢谢你花点时间查查这个问题。任何帮助都是非常感谢的,因为我是一个初学者。

我正试图与Node.js合作,将SOAP/AXL呼叫转到v11.5思科呼叫管理器。我从这个个人博客中复制了代码,其中有一个非常棒的解释:http://blog.darrenparkinson.uk/2014/04/accessing-cisco-administrative-xml-axl.html

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

但是,当我运行这个程序时,我会得到一个http.599错误。我有一种奇怪的感觉,它与安全有关,但我不能把我的手指放在它。

这是我的密码。

代码语言:javascript
复制
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);
});
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-09-08 22:52:35

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

  • 第5行,AXL对SOAPAction值的格式很挑剔: 'SOAPAction':'"CUCM:DB ver=11.5 listCss"',
  • 第10行,信封('axl')中定义的XML命名空间与请求('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">' +
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46123305

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档