cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alx <otinan...@gmail.com>
Subject Re: How to set mustUnderstand attribute in WS-Addressing headers
Date Wed, 08 Apr 2015 05:52:59 GMT
By default mustUnderstand headers are not set when using WS-SecurityPolicy.

I ended up using an interceptor for this, both in the client and server:

public class AddressingMustUnderstandInterceptor extends
AbstractSoapInterceptor {

    public AddressingMustUnderstandInterceptor () {
        super(Phase.WRITE);
    }

    @Override
    public void handleMessage (SoapMessage message) throws Fault {
        List <Header> list = message.getHeaders();
        list.stream().forEach(header -> ((SoapHeader)
header).setMustUnderstand(true));
    }

}

On Tue, Apr 7, 2015 at 6:28 PM, Andrei Shakirin <ashakirin@talend.com>
wrote:

> Hi,
>
> Some answers are inlined:
>
> > -----Original Message-----
> > From: Alx [mailto:otinanism@gmail.com]
> > Sent: Donnerstag, 2. April 2015 14:54
> > To: users@cxf.apache.org
> > Subject: How to set mustUnderstand attribute in WS-Addressing headers
> >
> > Requirement from my client is to set the mustUnderstand atrribute to "1"
> in To-
> > Element and Action-Element of WS-Addressing.
> >
> > I managed to do that on the client using the following:
> >
> > AddressingProperties maps = new AddressingPropertiesImpl(); List<QName>
> > mustUnderstandList = maps.getMustUnderstand();
> > mustUnderstandList.add(Names.WSA_ACTION_QNAME);
> > mustUnderstandList.add(Names.WSA_TO_QNAME);
> > ctx.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, maps);
> >
> > (By the way this sets the mustUnderstand attribute to "true" and not to
> "1"
> > I suppose that it is the same thing?)
>
> Specified value is "true", but intermediaries be able to substitute "true"
> for the value "1", or "false" for "0". See
> http://www.w3.org/TR/2003/REC-soap12-part1-20030624 (SOAP mustUnderstand
> Attribute) for details.
>
> >
> > On the server I am not sure how to proceed.
> >
> > Also I would prefer if there was a standard way to do it (i.e.
> > WS-SecurityPolicy or maybe CXF interceptor used in both the client and
> the
> > server?)
>
> You can either explicitly add WS-Addressing feature on the server and
> client or activate WSA using WS-Policy <Addressing> assertion:
> http://cxf.apache.org/docs/ws-addressing.html . Take a look here for the
> samples:
> https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/ws_addressing
>
> Regards,
> Andrei.
>
> >
> > Any help will be appreciated.
> >
> > Alex
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message