1

I have created a web service client using spring ws template. This is working as expected for http protocol. Now I want to make it work with https. I have the relevant client key store(the jks file) and now I want to configure the message sender to send secure request. Could you please help me on how to proceed on this?

Here is my spring bean configuration:

<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"/>
<bean id="tokenrMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
    <property name="contextPath" value="com.token.dto.v1" />
</bean>
<bean id="tokenServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
    <constructor-arg ref="messageFactory" />
    <property name="marshaller" ref="tokenrMarshaller"></property>
    <property name="unmarshaller" ref="tokenrMarshaller"></property>
    <property name="messageSender">
        <bean class="org.springframework.ws.transport.http.HttpComponentsMessageSender" />    
    </property>
    <property name="defaultUri" value="${token.url}" />       
</bean>

If I change the url from http to https w/o any configuration, the application throws "org.springframework.ws.client.WebServiceTransportException".

informatik01
  • 16,038
  • 10
  • 74
  • 104

1 Answers1

0

See javadoc for http://docs.spring.io/spring-ws/site/apidocs/org/springframework/ws/transport/http/HttpComponentsMessageSender.html#setHttpClient%28org.apache.http.client.HttpClient%29

Set httpClient property of messageSender bean.

See my other post on how to configure httpClient bean to work around self-signed certificate issues. sending https post request with post data using spring web

No need to import keys into keystore.

Community
  • 1
  • 1