Jus*_*ble 3 spring web-services spring-ws jax-ws
我有一个Web应用程序,它充当使用Spring WS实现的Jax-WS Web服务的客户端.Spring WS配置为在SOAP标头中需要用户名标记.在Web应用程序中,我计划使用Spring Web服务模板,但我似乎找不到任何显示如何将UsernameToken添加到传出请求的示例.
有人能指出我正确的方向吗?
谢谢.
jdd*_*lla 11
你必须使用拦截器.请参见第7章使用Spring-WS保护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>
<bean id="wsSecurityInterceptor" class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
    <property name="securementActions" value="UsernameToken"/>
    <property name="securementUsername" value="Ernie"/>
    <property name="securementPassword" value="Bert"/>
</bean>
| 归档时间: | 
 | 
| 查看次数: | 16982 次 | 
| 最近记录: |