尝试使用节点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>
谢谢
答案 0 :(得分:0)
可以用以下方法解决:
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);
});
});
问题是:有必要建立前缀“ser” wsdlOptions