我正在尝试为WS调用设置超时和SSL(https):
- PS:不需要标记为重复,唯一相似的question从未被回答过。*
1.我尝试了HttpsUrlConnectionMessageSender,它增加了对(自签名)HTTPS证书的支持,但它确实支持超时。
1.当我切换到支持超时(连接和读取超时)的HttpComponentsMessageSender时,它确实支持SSL。
我想在调用WS时将timeout和ssl合并为:
webServiceTemplate.setDefaultUri(uri);
response = webServiceTemplate.marshalSendAndReceive(inputs, new SoapHandler(createCredentials(), soapAction));
2条答案
按热度按时间v8wbuo2f1#
最后,使用HttpComponentsMessageSender完成了它。下面是我的代码:
我还创建了一个新的工厂类
HttpClientFactory
,用于设置SSL和超时:有关信息,SslUtils只是一个保存密钥库和信任库信息的bean类:
这对我很有效,让我同时使用SSL和超时。我希望这对其他人有帮助。
ibps3vxo2#
在使用带有基本身份验证的HTTPS协议的情况下,您可能不需要证书,您可以将编码的username:password设置到请求的标头中