wsse:security的命名空间

时间:2013-04-01 12:14:41

标签: spring xml-namespaces spring-ws wss4j wsse

我的问题是我正在尝试调用具有Wss4jSecurityInterceptor的用户名密码身份验证的Web服务。

生成的请求是这样的:

<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" SOAP-ENV:mustUnderstand="1">

这不起作用,但是当我更改名称空间,即 xmlns:wsse

<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext" SOAP-ENV:mustUnderstand="1">

它工作正常。

我想知道如何更改使用我的代码

中的标记生成的命名空间

1 个答案:

答案 0 :(得分:0)

您可以扩展EndpointInterceptorAdapter并覆盖方法handleResponse,如下所示:

@Override
public boolean handleResponse(MessageContext messageContext_, Object endpoint_) {

WebServiceMessage _webServiceMessage = messageContext_.getResponse();
SoapMessage _soapMessage = (SoapMessage) _webServiceMessage;


if (_soapMessage != null) {
SoapEnvelope _soapEnvelope = _soapMessage.getEnvelope();

if (_soapEnvelope != null) {

SoapHeader _soapHeader =_soapEnvelope.getHeader();
// modify the soapheader by casting to a DOMSource and manipulate the nodes