我有一个使用Docker容器在Bluemix中部署的微服务项目。所有的微服务都是用Java编写的,并且通信是使用JKS文件。
我还开发了一个使用Express.js的Node.js微服务。为了消费其他的微服务,我使用了Request模块和option.agentOptions
功能以及pfx文件
,就像这样:
var options = {
uri: config.get("https://www.example.com/ms/service"),
method: 'POST',
body: data,
json: true,
headers: {
'Content-Type': 'application/json; charset=UTF-8'
},
agentOptions: {
pfx: fs.readFileSync(config.get("/path/to/file.pfx")),
passphrase: config.get("passphraseText"),
servername: config.get("serverName")
}
};
request(options, function (error, response, data) {
//handing response
});
我尝试使用Solicit crate和默认示例进行HTTPS通信,但出现错误:
4 | use solicit::http::client::tls::TlsConnector;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Could not find `tls` in `client`
我找不到其他的板条箱、库或框架来完成它,我该如何进行这些请求?
编辑
显然,Solicit由于缺乏维护已经不再是这个问题的替代方案,原因在这里。
error: Package openssl 'v0.9.12' does not have these features: 'tlsv1_2, npn'
, 我还添加了openssl = { version = "0.9.12", features = ["v101", "v102", "v110"] }
但第二个错误仍然存在。 - Deoxyseia