我正在尝试使用 node-soap 客户端向 wdsl 发送请求
这是我的代码:
var url = 'https://bpm.shaparak.ir/pgwchannel/services/pgw?wsdl';
soap.createClient(url, function(err, client) {
var today = new Date();
var params = {
terminalId: "1926577",
userName: "test2",
userPassword: "test1",
orderId: receipt.recieptId + "",
amount: parseInt(receipt.overal_price) + "",
localDate: today.format('ymd'),
localTime: today.format('His'),
additionalData: "Customer No: 15220",
callBackUrl: "http://test.ir/pay/verify",
payerId: parseInt(receipt.user) + ""
};
console.log(params);
client.bpPayRequest(params, function(err, result) {
if (err) {
throw err;
}
console.log(result);
});
并且从 wsdl 返回此错误:
错误:soap:Client:发现意外的包装元素 bpPayRequest。
预期 { http://interfaces.core.sw.bps.com/ }bpPayRequest。
似乎 ns1 没有作为前缀添加到
xml 请求中的节点
我将模块更新为 v0.13.0 并添加了以下内容:
used this code :
var options = {
ignoredNamespaces: {
namespaces: [],
override: true
}
}
还是一样的错误:(
临时修复 将此添加到 node-soap 的 wsdl.js 文件的第 1496 行:
name = 'ns1:'+name;