Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache CXF - WS addressing how to remove/delete ReplyTo from Headers

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?

like image 849
afterbit Avatar asked Nov 09 '22 22:11

afterbit


1 Answers

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);
like image 197
Kevin STS Avatar answered Jan 04 '23 03:01

Kevin STS