【发布时间】:2016-10-15 10:08:19
【问题描述】:
我正在使用strong-soap(node-soap 的分支)和部署在 IBM Bluemix 上的 node.js 应用程序。肥皂客户端是通过加载本地 wsdl 文件创建的soap.createClient,它在我们的开发人员本地机器上都可以正常工作。但是,当项目部署到 Bluemix 时,创建的客户端没有任何服务。 soap.createClient 创建客户端的过程中没有出现错误,但 client.describe() 为空 {} 并且不能对其调用任何服务或方法。
我已检查 wsdl 是否已找到并正确加载,fs.existsSync 表示该文件存在。
我已尝试在 Bluemix 上实时调试应用程序并逐步调试代码,没有引发任何错误,但客户端没有任何操作。我被难住了,有人可以帮忙吗?
日志文件只有一个错误:SOAP service was not correctly initialized in the client.,这是从下面的代码返回的。 Stenaline 是来自wsdl 的服务名称,所以在我的本地机器上client.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);
});
};
【问题讨论】:
-
能否请您添加一个示例代码,以便有人可以帮助您?另外,请添加
cf logs appname --recent的输出,以便有人可以检查错误。 -
@AlexdaSilva 我已经添加了代码。那里真的没什么特别的。日志中没有错误。
-
@AlexdaSilva 这是强肥皂的问题。我现在已经切换到使用 node-soap (github.com/vpulim/node-soap),它工作正常。
标签: node.js soap wsdl ibm-cloud node-soap