Hello!

I have a (proxy) client inside a server environment. (I have more clients) And, need to turn on the WSA, and the mustUnderstand attribute in some fields (not all, and not for all client)

I already set up the config:

  <jaxws:client id="ClientRegistry"
        serviceClass="myServicePortType"
        address="http://myEndpoint";>
        <jaxws:binding>
        <soap:soapBinding version="1.2" mtomEnabled="false" />
        </jaxws:binding>
        <jaxws:features>
            <wsa:addressing xmlns:wsa="http://cxf.apache.org/ws/addressing"/>
          </jaxws:features>
      </jaxws:client>

Its create the WSA elements into the header, but no clue how to set some to mustUnderstand.

I found a solution (https://mail-archives.apache.org/mod_mbox/cxf-users/201504.mbox/%3cd225cd69196f3f4a9f4174b2fca06f8812111...@s10be002.sh10.lan%3E):

    final MessageContext mc = wsContext.getMessageContext();

    AddressingProperties maps = new AddressingPropertiesImpl();
    List<QName> mustUnderstandList = maps.getMustUnderstand();
    mustUnderstandList.add(Names.WSA_ACTION_QNAME);
    mustUnderstandList.add(Names.WSA_TO_QNAME);
    mc.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, maps);


but for that, I need a MessageContext, but in my code I have only BindingProvider (after cast the myServicePortType class).

There are more solution to create the header WSA nodes by code:

       List<Header> headers = new ArrayList<Header>();
        // action:
        Header actionHeader = new Header(new QName("http://www.w3.org/2005/08/addressing";, "Action"), "myaction",
                new JAXBDataBinding(String.class));
        headers.add(actionHeader);
bindingProvider.getRequestContext().put(Header.HEADER_LIST, headers);

But I think with the features is more elegant.

I looking the  BindingProvider version of the first solution...

Thanx

Csaba


ps: there is a method to turn on the outgoing message multipart if needed (if there is a binary payload, and not for always?)


Reply via email to