Reputation: 2087
Im trying to send request to a wdsl with node-soap client
here is my code :
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);
});
and this error returned from wsdl :
Error: soap:Client: Unexpected wrapper element bpPayRequest found.
Expected {http://interfaces.core.sw.bps.com/}bpPayRequest.
It seems the ns1 is not added as a prefix to
node in xml request
I updated the module to v0.13.0 and added following :
used this code :
var options = {
ignoredNamespaces: {
namespaces: [],
override: true
}
}
Still same error :(
TEMPORARILY FIX add this to line 1496 of wsdl.js file of node-soap :
name = 'ns1:'+name;
Upvotes: 4
Views: 9364
Reputation: 103
Use this:
var options = {
overrideRootElement: {
namespace: 'ns1'
}
};
It works on version 0.16
Upvotes: 4
Reputation: 38
In version 0.16.0 you should change line 1530:
WSDL.prototype.objectToDocumentXML = function(name, params, nsPrefix, nsURI, type) {
var args = {};
args["ns1:" + name] = params; // instead of args[name] = params;
...
Upvotes: 0
Reputation: 16748
As of version 0.16.0 the suggested solution of resetting the ignoredNamespaces
works again:
var options = {
ignoredNamespaces: {
namespaces: [],
override: true
}
}
Upvotes: 0
Reputation: 56
Had the same Problem with Version 0.14.0 of node-soap.
Switching back to 0.11.0 solved it for me.
Upvotes: 2