尝试使用节点soap调用web服务不起作用,但如果它在SoapUI中起作用
var soap = require('soap');
var url = 'http://190.129.208.178:96/PasarelaServices/CustomerServices?wsdl';
var args = { "key": '12345', "parametros": 'parameters...' };
soap.createClient(url, function (err, client) {
console.log(client.describe());
console.log(client.describe().CustomerServices.CustomerServicesPort.solicitarPago);
client.CustomerServices.CustomerServicesPort.solicitarPago(args, function (err, result, raw, soapHeader) {
console.log(err);
console.log(result)
console.log(raw);
});
});在SoapUI请求中:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.vlink.com.bo/">
<soapenv:Header/>
<soapenv:Body>
<ser:solicitarPago>
<key>12345</key>
<parametros>parameters...</parametros>
</ser:solicitarPago>
</soapenv:Body>
</soapenv:Envelope>谢谢
发布于 2016-11-08 23:40:45
可以通过以下方法解决:
var soap = require('soap');
var url = 'http://190.129.208.178:96/PasarelaServices/CustomerServices?wsdl';
var wsdlOptions = {
"overrideRootElement": {
"namespace": "ser",
"xmlnsAttributes": [{ "name": "xmlns:ser", "value": "http://services.vlink.com.bo/" }]
}
};
var args = { "key": '12345', "parametros": 'parameters...' };
soap.createClient(url, wsdlOptions, function (err, client) {
client.solicitarPago(args, function (err, result, raw, soapHeader) {
console.log(result);
});
});问题是:必须用wsdlOptions建立前缀"ser“
https://stackoverflow.com/questions/40472018
复制相似问题