这是我的代码,除了调用肥皂方法之外,一切都在工作返回错误,请帮助:)
"use strict";
var easysoap = require('easysoap');
// define soap params
var params = {
host: 'www.privateqa.invoice4u.co.il',
path: '/Services/MeshulamService.svc',
wsdl: '/Services/MeshulamService.svc?singleWsdl',
}
/*
* create the client
*/"
var soapClient = easysoap.createClient(params);
/* * get all available functions */
soapClient.getAllFunctions()
.then((functionArray) => { console.log(functionArray); })
.catch((err) => { throw new Error(err); });
/* * get the method params by given methodName */
soapClient.getMethodParamsByName('ProccessRequest')
.then((methodParams) => {
console.log(JSON.stringify(methodParams.request));
// console.log(JSON.stringify(methodParams.response));
return methodParams;
})
.catch((err) => {
console.log(err); });
/* * 调用肥皂法 */
soapClient.call({
method : 'ProccessRequest',
attributes: {
xmlns: "https://privateqa.invoice4u.co.il/"
},
params: {
'UserEmail' : 'test@test.com',
'UserPassword': '123456',
'FullName': 'idan tabachnik',
'Phone': '0525410849',
'Sum': 10.00,
'PaymentsNum': 1,
'Type': 1,
'ReturnUrl': 'mako.co.il'
}
}).then((callResponse) => {
debugger;
console.log(callResponse.data); // response data as json
// console.log(callResponse.body); // response body
// console.log(callResponse.header); //response header
}).catch((err) => { throw new Error(err); });
我收到的错误"未处理的承诺拒绝警告:未处理的承诺拒绝">
http://private.invoice4u.co.il/Services/LoginService.svc
我希望你已经解决了这个问题。如果没有,请检查代码的最后一行。您正在抛出错误,但您没有编写任何内容来捕获该错误。这就是它显示未处理的承诺拒绝错误的原因。您可以打印错误或编写一些方法来在其他位置捕获错误。
这是一个链接,可帮助您解决投掷和接球错误