0

我的问题是我正在尝试调用具有 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">

它工作正常。

我想知道如何更改使用<wsse:Security>代码中的标记生成的命名空间

4

1 回答 1

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
于 2013-04-01T15:55:25.283 回答