【问题标题】:Implementation of soap client in node.js with easy-soap用easy-soap在node.js中实现soap客户端
【发布时间】:2017-06-20 19:48:11
【问题描述】:

这是我的代码,除了 call soap 方法外,一切都正常 返回错误,请帮助:)

 "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); });

/* * 调用soap方法 */

            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); });

我收到“UnhandledPromiseRejectionWarning: Unhandled Promise Rejection”的错误

http://private.invoice4u.co.il/Services/LoginService.svc

【问题讨论】:

    标签: javascript node.js web-services soap


    【解决方案1】:

    我希望你已经解决了这个问题。如果没有检查你的代码的最后一行。您正在抛出错误,但您没有编写任何内容来捕获该错误。这就是为什么它显示未处理的承诺拒绝错误。您可以打印错误或编写一些方法来在其他地方捕获错误。

    这里有一个link 来帮助您解决投掷和接球错误

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-01-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-26
      • 2019-08-06
      相关资源
      最近更新 更多