2013-02-28 125 views
1

我试图编写我的Spring Web服务端点的服务器端集成测试,使用 - Spring WS Security 2.1.2.RELEASE和 - WSS4j 1.6.9。 我正在尝试关注Spring文档http://static.springsource.org/spring-ws/sites/2.0/reference/html/server.html。与我有这么远的设置,我可以给使用MockWebServiceClient请求负载安全的Spring Web服务集成测试

<myns:MyRequest xmlns:myns="..."> 
     ... 
</myns:MyRequest> 

mockWebServiceClient.sendRequest(withPayload(requestPayload)).andExpect(clientOrSenderFault()); 

它集成测试正确映射到在测试范围内的终点,我也得到一个“无法验证请求:未找到WS-Security头”错误如预期。

问题:现在这里的问题是,如果我发送带有安全头和正文的SOAP信封中的请求,我会得到一个未找到端点的异常。

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:myns="..."> 
    <soapenv:Header> 
     ... 
    </soapenv:Header> 
    <soapenv:Body> 
     <myns:MyRequest> 
     ... 
     </myns:MyRequest> 
    </soapenv:Body> 
</soapenv:Envelope> 

因为它会试图找到围绕“Envelope”的端点。

有没有办法解决这个问题?

+0

更新版本的Spring WS Test 2.1版在RequestCreaters中添加了两个方法:RequestCreator withSoapEnvelope(Source soapEnvelope)和RequestCreator withSoapEnvelope(资源soapEnvelope),我可以使用它发送SOAP信封以进行集成测试。 http://forum.springsource.org/showthread.php?135298-Integration-Testing-of-secure-Spring-Web-Service – Lal 2013-03-01 19:09:23

回答