web-services - JAX-WS 客户端 |发送带有安全 header 的客户端请求

标签 web-services spring-security spring-ws

为了安全起见,我使用 XWSS 实现了 Spring WS。我已将安全配置策略文件添加到我的应用程序中。

<xwss:SecurityConfiguration xmlns:xwss="http://java.sun.com/xml/ns/xwss/config"
    dumpMessages="true">    
    <xwss:RequireTimestamp 
        id="tsp" 
        maxClockSkew="60" 
        timestampFreshnessLimit="300">
    </xwss:RequireTimestamp>
    <xwss:RequireUsernameToken 
        id="token" 
        passwordDigestRequired="false" 
        nonceRequired="false"/>
    <xwss:Timestamp></xwss:Timestamp>
    <xwss:UsernameToken 
        name="service" 
        password="service" 
        id="uToken" 
        digestPassword="true"
        useNonce="true"/>
</xwss:SecurityConfiguration>

现在我正在开发一个客户端来访问WS。保安工作正常。但我无法测试客户端可以成功从我的服务获得响应的成功案例。问题是我不知道如何让我的客户端随请求一起发送用户名 token 和时间戳。我正在使用 NetBeans IDE,并且正在实现 JAX-WS 客户端以使用 this tutorial 访问 Spring WS .

请让我知道需要做什么。

最佳答案

对于 Spring WSS,将安全 header 添加到传入的 SOAP 消息或传出的 SOAP 消息中没有太大区别。这个过程非常相似。

在这两种情况下,您都应该创建一个拦截器来添加安全 header 。描述here 。因此,如果您使用 Spring 创建 WS 客户端,那么应该不会有问题,特别是如果您已经开发了服务器端,但您引用的教程看起来不像使用 Spring 来实现客户端。

关于web-services - JAX-WS 客户端 |发送带有安全 header 的客户端请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9629906/

相关文章:

java - 在 Spring-Boot 中为 soap webservice 抛出自定义异常?

python - SOAP 网络服务 : Python server and perl client

Spring + SOAPExceptionImpl : Error during saving a multipart message

soap - 如何将 WSDL 与 spring-boot 结合使用?

java - 使用 junit/spring-test 运行测试用例来测试 spring WS web 服务时出现 NoInitialContextFound 异常

node.js - 如果我使用 send 或 json, Node 应用程序崩溃

web-services - 如何使用 Hunchentoot 为更多线程提供服务

Spring Boot CORS 过滤器 - CORS 预检 channel 未成功

java - Spring Security @AuthenticationPrincipal

url - 使用 Spring Security 进行预身份验证 -> 基于 URL 参数