I generated a bunch of client classes from a WSDL with CXF’s wsdl2java. How do I add WS-Security to the header when doing something like this:
URL url = new URL("http://fqdn:8080/service/MessageHandler");
MessageHandlerService service = new MessageHandlerService(url);
MessageHandler handler = service.getMessageHandler();
MyMessage message = new MyMessage();
message.setSender("User 1");
handler.sendMessage(message);
I think handler is a javax.xml.ws.Service instance.
Then if you cast the client to a
BindingProvideryou can change the endpoint as needed programatically.