use of org.apache.cxf.headers.HeaderManager in project BIMserver by opensourceBIM.
the class GenericWebServiceServlet method loadBus.
public void loadBus(ServletConfig servletConfig) {
this.bus = BusFactory.newInstance().createBus();
Bus bus = getBus();
HeaderManager headerManager = bus.getExtension(HeaderManager.class);
headerManager.registerHeaderProcessor(new HeaderProcessor() {
@Override
public String getNamespace() {
return "uri:org.bimserver.shared";
}
@Override
public InterceptorProvider getInterceptorProvider() {
return null;
}
@Override
public DataBinding getDataBinding() {
try {
return new JAXBDataBinding(Token.class);
} catch (JAXBException e) {
LOGGER.error("", e);
}
return null;
}
});
BusFactory.setDefaultBus(bus);
for (Class<? extends PublicInterface> clazz : getBimServer().getServicesMap().getInterfaceClasses()) {
JaxWsServerFactoryBean serverFactoryBean = new JaxWsServerFactoryBean();
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("mtom-enabled", Boolean.TRUE);
serverFactoryBean.setBindingId(bindingId);
serverFactoryBean.setProperties(properties);
serverFactoryBean.setServiceClass(clazz);
serverFactoryBean.getOutFaultInterceptors().add(new StatusCodeModifyingFaultInterceptor());
serverFactoryBean.setInvoker(new CustomInvoker(getBimServer().getServiceFactory(), clazz));
if (getBimServer().getConfig().getEnvironment() != Environment.WAR) {
// equals check allowed, just keep using the constant
serverFactoryBean.setAddress((bindingId == WSDLConstants.NS_SOAP11 ? "/soap11/" : "/soap12/") + clazz.getSimpleName());
} else {
// equals check allowed, just keep using the constant
serverFactoryBean.setAddress("/" + clazz.getSimpleName());
}
serverFactoryBean.setTransportId("http://schemas.xmlsoap.org/soap/http");
serverFactoryBean.create();
}
}
Aggregations