5

I'm trying to implement WS-Addressing with Apache CXF 2.7.18. I am able to set some headers like To, Action, etc.. but I want to remove/delete ReplyTo from SOAP request

<Action xmlns="http://www.w3.org/2005/08/addressing">http://...</Action>
<MessageID xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:....</MessageID>
<To xmlns="http://www.w3.org/2005/08/addressing">https://....</To>
<ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
        <Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
</ReplyTo>

Does anybody know how to do it?

afterbit
  • 383
  • 7
  • 20

1 Answers1

1

I found a solution even if it's little bit dirty but it works for me. I've explicitly set it to "null" (using Cxf and JaxWsProxyFactoryBean).

    EndpointReferenceType replyTo = new EndpointReferenceType();
    AddressingProperties addrProperties = new AddressingProperties();
    AttributedURIType replyToURI = new AttributedURIType();

    EndpointReferenceType from = new EndpointReferenceType();
    AttributedURIType fromURI = new AttributedURIType();
    fromURI.setValue("ms-register");
    from.setAddress(fromURI);
    addrProperties.setFrom(from);
    addrProperties.setFrom(from);

    replyToURI.setValue(null);
    replyTo.setAddress(replyToURI);
    addrProperties.setReplyTo(replyTo);
    client.getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES,addrPropertie);
Kevin STS
  • 183
  • 2
  • 10