0

我正在使用strong-soap(node-soap 的分支)和部署在 IBM Bluemix 上的 node.js 应用程序。肥皂客户端是soap.createClient通过加载本地 wsdl 文件创建的,它在我们的开发人员本地机器上都可以正常工作。但是,当项目部署到 Bluemix 时,创建的客户端没有任何服务。在客户端创建过程中不会发生错误,soap.createClientclient.describe()它是空的{},并且不能在其上调用任何服务或方法。

我已检查是否找到并正确加载了 wsdl,并fs.existsSync说该文件存在。

我已经尝试在 Bluemix 上实时调试应用程序并单步执行代码,没有抛出任何错误,但客户端没有任何操作。我被难住了,有人可以帮忙吗?

日志文件只有一个错误:SOAP service was not correctly initialized in the client.从下面的代码返回。Stenaline是来自 wsdl 的服务名称,因此在我的 localmachineclient.Stenaline上设置正确并且可以在其上调用操作。

完整的连接功能

var soapClient = null;
var connect = function (create_callback) {
  var options = {
    endpoint: config.endpoint
  };

  var wsdl = './src/config/contract/www.stenaline.com.sloop.ws.2014.10.wsdl';

  if (!fs.existsSync(wsdl)) {
    let err = new Error('Failed to locate SOAP wsdl file.');
    err.path = wsdl;
    return process.nextTick(function () {
      create_callback(err);
    });
  }

  soap.createClient(wsdl, options, function (err, client) {
    if (err) return create_callback(err);

    client.setSecurity(wsSecurity);
    soapClient = client;

    debug('client', client.describe());

    if (!client.Stenaline) {
      let err = new Error('SOAP service was not correctly initialized in the client.');
      return process.nextTick(function () {
        create_callback(err);
      });
    }

    create_callback(null, client);
  });
};
4

2 回答 2

0

在 AWS Lambda 上使用strong-soap时遇到了同样的问题,通过交换node-soap也解决了这个问题

于 2017-03-24T14:52:15.667 回答
0

这看起来像强肥皂中的错误。

从https://github.com/vpulim/node-soap切换到使用 node-soap并解决了问题。

于 2016-10-17T12:32:39.883 回答