Nodejs SOAP模块 - timout选项

时间:2017-01-18 22:59:31

标签: node.js soap

如何设置soap.createClient和/或client.myFunction的超时?文档中没有提到它。如果不可能,有解决方法吗?

2 个答案:

答案 0 :(得分:6)

经过一个小时的尝试,我找到了它,基本上它使用了请求,wsdl_options将覆盖request选项。你可以按照下面的例子。 :))

soap.createClient(url, {wsdl_options: {timeout: 5000}}, callback)

参考:https://github.com/vpulim/node-soap#options

答案 1 :(得分:-1)

这是node-soap文档中提到的内容

client.MyService.MyPort.MyFunction({name: 'value'}, function(err, result) {
    // result is a javascript object
}, {timeout: 5000})

选项在回调函数后设置为第3个参数。
https://github.com/vpulim/node-soap#options-optional

基本上它使用request模块进行http传输。所以请求模块的选项对soap模块也是有效的

相关问题