2012-02-14 103 views
2

我已經閱讀了關於Securing your Web services with Spring-WS的Spring文檔,但它看起來像是文章只是關於服務器端而不是客戶端。事實上,它在Wss4jSecurityInterceptor服務器端工作正常,但我需要簽署一個請求到外部Web服務。用Spring在客戶端簽名SOAP請求

所以,第一個問題。我是否正確,Spring Web Services文檔的第7章僅適用於服務器端?

二。使用類似(簡單,優雅)與在服務器端完成的方式類似的方式,使用Spring將客戶端上的SOAP請求添加到客戶端的SOAP請求中,可以像簽名頭一樣添加安全性?

我找到了question,但它看起來好像是用Apache CXF和article完成的簽名是以自制的方式完成的。

在此先感謝。

+0

只是澄清:我到底想做什麼是簽署請求。 – jddsantaella 2012-02-14 17:09:50

回答

1

好了,我怕我會回答我的問題:

第一個NO。 Spring Web Services文檔的第7章介紹了雙方,客戶端和服務器。

第二個:與答案的最前一頁的問題,YES Acording,因爲它是在春天的Web Services文檔的7章。

我的錯誤是,我是這樣宣稱攔截:

<sws:interceptors> 
    <ref bean="wsSecurityInterceptor" /> 
</sws:interceptors> 

,這只是攔截影響對服務器端的Web服務。對於客戶應該這樣做:

<bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate"> 
    <property name="marshaller" ref="marshaller" /> 
    <property name="unmarshaller" ref="marshaller" /> 
    <property name="defaultUri" 
     value="http://localhost:8080/ws-demo/myws" /> 
    <property name="interceptors"> 
     <list> 
      <ref bean="wsSecurityInterceptor" /> 
     </list> 
    </property> 
</bean>