无法通过' Async' -suffix宣传具有常规方法的API

时间:2017-11-10 07:16:21

标签: node.js soap promise

我正在尝试使用节点调用soap web服务。我用肥皂和请求包。

以下是代码段:

var express = require('express');
var Promise = require("bluebird");
var app = express();
var soap = require('soap')

var url = 'http://example.com?WSDL';
let request = require('request');
let request_with_defaults = request.defaults({
  'proxy': 'http://example.com:80',
  'timeout': 5000,
  'connection': 'keep-alive'
});
let soap_client_options = {
  'request': request_with_defaults
};
var args = {
  requestId: '1406303'
};
soap.createClient(url, soap_client_options, function(err, client) {
  var soapHeader = {
    "Username": "test",
    "Password" : "test"
  };
  client.addSoapHeader(soapHeader);

  client.getESSJobStatus(args, function(err, result) {
    if(err){
      console.log('Error occured');
    }
    console.log(result);
  });
})

这里我收到错误:

throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a    See http://bluebirdjs.com/docs/error-explanations.htmlX\u000a"
TypeError: Cannot promisify an API that has normal methods with 'Async'-suffix
See http://bluebirdjs.com/docs/error-explanations.html

我查了这个网址。它说是创建了无法调用的异步任务。但我无法将此与此联系起来。

任何人都可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

尝试{{1}}