2012-02-14 104 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>