我正在尝试将 Soap 客户端配置为使用智能卡中的证书在 Spring boot (java) 中进行身份验证我可以通过代码访问证书:
private Certificate getCert() throws Exception {
KeyStore ks = KeyStore.getInstance("Windows-MY");
ks.load(null, null);
String alias = "Hubba";
return ks.getCertificate(alias);
}
但我不确定如何将其放入 Soap 客户端:
@Bean
public Jaxb2Marshaller marshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setContextPath("com.hubba.bu");
return marshaller;
}
@Bean
public SoapClient soapClient(Jaxb2Marshaller marshaller) {
SoapClient client = new SoapClient();
client.setWebServiceTemplate(webServiceTemplate());
return client;
}
@Bean
public WebServiceTemplate webServiceTemplate() {
WebServiceTemplate webServiceTemplate = new WebServiceTemplate();
webServiceTemplate.setMarshaller(marshaller());
webServiceTemplate.setUnmarshaller(marshaller());
webServiceTemplate.setDefaultUri("https://test.com/api");
}
有人可以给我建议吗?