我已經使用spring ws模板創建了一個Web服務客戶端。這符合http協議的預期。現在我想讓它與https協同工作。我有相關的客戶端密鑰存儲(jks文件),現在我想配置消息發送者發送安全請求。 你能幫我解決這個問題嗎?使用Spring WebserviceTemplate發送安全請求
這裏是我的Spring bean配置:
<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>
如果我改變從HTTP到HTTPS的網址W/O任何配置,應用程序將引發 「org.springframework.ws.client.WebServiceTransportException」。