【问题标题】:Sign SOAP request on client-side with Spring使用 Spring 在客户端签署 SOAP 请求
【发布时间】:2012-02-14 17:03:14
【问题描述】:

我已经阅读了有关 Securing your Web services with Spring-WS 的 Spring 文档,但它看起来好像这篇文章只是关于服务器端而不是客户端。确实,使用Wss4jSecurityInterceptor 的服务器端运行良好,但我需要签署对外部 Web 服务的请求。

那么,第一个问题。我说得对吗,Spring Web Services 文档的第 7 章只适用于服务器端?

第二。是否可以使用 Spring 以类似于(简单、优雅)在服务器端完成的方式向客户端的 SOAP 请求添加安全性(如签名标头)?

我找到了这个 question,但看起来签名是使用 Apache CXF 完成的,而这个 article 签名是用自制的方式完成的。

提前致谢。

【问题讨论】:

  • 澄清一下:我真正想做的就是签署请求。

标签: java client-side spring-ws sign


【解决方案1】:

好吧,恐怕我要回答我自己的问题了:

第一个:否。 Spring Web Services 文档的第 7 章是关于客户端和服务器端的。

第二个:根据第一个问题的答案,YES,如 Spring 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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-18
    相关资源
    最近更新 更多