Skip to content

Instantly share code, notes, and snippets.

@jdennaho
Last active December 16, 2015 07:19
Show Gist options
  • Save jdennaho/5398253 to your computer and use it in GitHub Desktop.
Save jdennaho/5398253 to your computer and use it in GitHub Desktop.
set targetNamespace at runtime on JAX-WS proxy when using org.apache.cxf.jaxws.JaxWsProxyFactoryBean
public <T> T getServiceClient(Class<T> interfaceClass, final String targetNamespace) {
JaxWsProxyFactoryBean interfaceFactory = new JaxWsProxyFactoryBean();
interfaceFactory.setServiceFactory(new JaxWsServiceFactoryBean() {
@Override
protected OperationInfo createOperation(ServiceInfo serviceInfo, InterfaceInfo intf, Method m) {
intf.setName(new QName(targetNamespace, intf.getName().getLocalPart())); //overwrite the default namespace with target
return super.createOperation(serviceInfo,intf,m);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment