我目前正在开发一个基于节点的应用程序,试图向基于 SOAP 的服务发出请求。我正在使用 node-soap 模块来解决这个问题。 https://github.com/vpulim/node-soap
目前我有以下实现
var soap = require('soap');
var url = 'http:/xxxx/xxxx/xxxx?WSDL';
var appKey = 'ABYRCEE';
var xml = {
appKey: appKey,
mac: 'xxxxxxxx'
}
soap.createClient(url, function(err, client){
//console.log('Client:', client);
client.getAllDocsisVideoInfo(xml, function(err, result){
if(err){
console.log(err);
}
});
});
为了让服务响应,我有一个 xml 格式的示例请求,如下所示
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:doc="http://xxx.xxx.com">
<soapenv:Header/>
<soapenv:Body>
<doc:getAllDocsisVideoInfo>
<appKey>"appKey"</appKey>
<mac>xxxxxxx</mac>
</doc:getAllDocsisVideoInfo>
</soapenv:Body>
</soapenv:Envelope>
从上面可以看出,我必须传入appKey和mac值,并且在成功请求后,这将以 xml 格式发送回带有适当响应的成功响应。
我能够看到客户端对象使用适当的函数返回,但是在调用client.getAllDocsisVideoInfo(....)时,我似乎看到了以下错误
S:Client:找不到 {}getAllDocsisVideoInfo 的调度方法
我不确定为什么?是因为我传递 xml 对象的方式,我如何传递示例请求?