所有,
感谢您抽出宝贵时间来检查这个问题。我是个初学者,对您的任何帮助都表示赞赏。
我正在尝试与Node.js一起将SOAP / AXL呼叫转移到v11.5 Cisco Callmanager。我已经从这个人的博客中复制了代码,该代码有一个非常棒的解释: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);
});
最佳答案
通过进行以下两项更改,我可以使您的代码正常工作:
第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">' +