I'm trying to configure a Soap Client to use Certificate from Smart card for authentication in Spring boot (java) I can access the certificate by code:
private Certificate getCert() throws Exception {
KeyStore ks = KeyStore.getInstance("Windows-MY");
ks.load(null, null);
String alias = "Hubba";
return ks.getCertificate(alias);
}
but I'm not sure how to put this in the Soap client:
@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");
}
Can someone advise me?
Here is an example of a Spring Boot WS project with producer and consumer apps. Basically, you have to use WebServiceTemplateBuilder.additionalMessageSenders()
during build process of WebServiceTemplate
bean.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.