4

I have a question: we are trying to implement WS-Addressing with Apache CXF. I am able to set some headers like To, or Action, but I don't find the way to set others like From, ReplyTo, or FaultTo.

Does anybody know how to do it?

user517663
  • 101
  • 2
  • 4

1 Answers1

7

Take a look at http://cxf.apache.org/docs/ws-addressing.html. It's on the end of the page:

AddressingProperties maps = new AddressingPropertiesImpl();
EndpointReferenceType ref = new EndpointReferenceType();
AttributedURIType add = new AttributedURIType();
add.setValue("http://localhost:9090/decoupled_endpoint");
ref.setAddress(add);
maps.setReplyTo(ref);
maps.setFaultTo(ref);

((BindingProvider)port).getRequestContext()
    .put("javax.xml.ws.addressing.context", maps);

kind regards, soilworker

soilworker
  • 1,317
  • 1
  • 15
  • 32
  • as a note, the ep.getFeatures().add(new WSAddressingFeature()); should be added to client proxy factory, before creation. without it the code above won't add address information – edward_wong Aug 19 '20 at 16:05