Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Nodejs、soap、callback不是函数_Node.js_Soap_Soap Client - Fatal编程技术网

Node.js Nodejs、soap、callback不是函数

Node.js Nodejs、soap、callback不是函数,node.js,soap,soap-client,Node.js,Soap,Soap Client,首先,我获得了pfx证书,a将其导出到pem,并使用openssl密钥(如果这可能是一个问题的话)。我尝试使用client.setSecurity(new soap.ClientSSLSecurit()),但之后我得到了未定义的客户机 我的代码是这样的: var soap = require('soap'), fs = require('fs'); var url = 'tes.com'; var auth = "Basic " + new Buffer("user" + ":" +

首先,我获得了pfx证书,a将其导出到pem,并使用openssl密钥(如果这可能是一个问题的话)。我尝试使用client.setSecurity(new soap.ClientSSLSecurit()),但之后我得到了未定义的客户机

我的代码是这样的:

var soap = require('soap'),
    fs = require('fs');
var url = 'tes.com';

var auth = "Basic " + new Buffer("user" + ":" + "password").toString("base64")



soap.createClient( url, {wsdl_options: {
    cert: fs.readFileSync('cert/certificate.pem'),
    key: fs.readFileSync('cert/certificate.key')
    }
}, { wsdl_headers: {Authorization: auth} }, function(err, client) {


    client.describe();

});
我得到了这个错误,不知道是什么错了:

callback(err, wsdl && new Client(wsdl, endpoint, options));
    ^

TypeError: callback is not a function
    at D:\web\mobile\node_modules\soap\lib\soap.js:50:5
    at D:\web\mobile\node_modules\soap\lib\soap.js:33:16
    at D:\web\mobile\node_modules\soap\lib\wsdl.js:2167:9
    at Request._callback (D:\web\mobile\node_modules\soap\lib\http.js:114:14)
    at self.callback (D:\web\mobile\node_modules\request\request.js:187:22)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at Request.onRequestError (D:\web\mobile\node_modules\request\request.js:813:8)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
tnx
米哈你的论点不正确。请这样更正:

soap.createClient( url, {wsdl_options: {
    cert: fs.readFileSync('cert/certificate.pem'),
    key: fs.readFileSync('cert/certificate.key')
    },
wsdl_headers: {Authorization: auth} }, function(err, client) {


    client.describe();

});

这个的Thx:)我修复了它,但现在得到:
client.descripe();^TypeError:无法读取未定义的D:\web\mobile\app.js:26:8在D:\web\mobile\node\modules\soap\lib\soap.js:50:5在D:\web\mobile\node\modules\soap\lib\soap.js:33:16在D:\web\mobile\node\modules\soap\lib\wsdl.js:2167:9在D:\web\mobile\mobile\mobile\mobile\node\soap.js:16的属性“description”?如果问题是证书或其他问题,如何进行调试?tnx@user2017319检查
err
objecttnx@Ebrahim Pasbani以获得快速回复。这是错误显示的内容:错误:connect ETIMEDOUT xxx.xxx.xxx.xxx:443 at Object.exports.\u errnoException(util.js:1007:11)at exports.\u TCPConnectWrap.afterConnect[as oncomplete](net.js:1080:14)处的主机端口(util.js:1030:20)异常[nodemon]应用程序崩溃-在启动前等待文件更改。。这是因为ssl还是其他原因?tnx@user2017319它表示超时异常。所以,检查主机是否为端口443打开,是否可以访问或看不到:)我和客户交谈,他们说我们这边的超时时间应该是第一次大约1分钟(他们的web服务行为)。是否可以在soap.createClient上设置此选项?我无法在回调上设置此选项,因为由于超时,回调中的客户端未定义。tnx