Thursday, February 26, 2009

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);

No comments:

Post a Comment