gpt4 book ai didi

node.js - Nodejs、soap、回调不是函数

转载 作者:太空宇宙 更新时间:2023-11-04 03:06:37 24 4
gpt4 key购买 nike

首先我得到了 pfx 证书,将其导出到 pem 并使用 openssl 进行 key (如果这可能是一个问题)。我尝试使用 client.setSecurity(newsoap.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();

});

关于node.js - Nodejs、soap、回调不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39139561/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com