Feb 25

CXF – How to set a custom endpoint address

For some reason it is rarely straight forward how to configure a Java Web Service framework to use a custom endpoint address (one that is not in the WSDL). Anyway, here is how you do it in CXF:

URL wsdl = getClass().getResource("myservice.wsdl.xml");
MyService service = new MyService(wsdl).getMyServicePort();
BindingProvider bp = (BindingProvider)service;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, URL);

Comment Form

Here you will find some of my thoughts and experiments from my daily life of programming and general geeking ;)

Github