this.endpoint = endpoint;
boolean isWebServiceProvider = false;
// now we just use the default bus here
Bus bus = BusFactory.getDefaultBus();
ServerFactoryBean svrBean = null;
if (endpoint.isSpringContextEndpoint()) {
CxfEndpointBean endpointBean = endpoint.getCxfEndpointBean();
svrBean = CxfEndpointUtils.getServerFactoryBean(endpointBean.getServiceClass());
isWebServiceProvider = CxfEndpointUtils.hasAnnotation(endpointBean.getServiceClass(),
WebServiceProvider.class);
endpoint.configure(svrBean);
CxfEndpointBean cxfEndpointBean = endpoint.getCxfEndpointBean();
if (cxfEndpointBean.getServiceName() != null) {
svrBean.setServiceName(cxfEndpointBean.getServiceName());
}
if (cxfEndpointBean.getEndpointName() != null) {
svrBean.setEndpointName(cxfEndpointBean.getEndpointName());
}
} else { // setup the serverFactoryBean with the URI paraments
Class serviceClass = ClassLoaderUtils.loadClass(endpoint.getServiceClass(), this.getClass());
svrBean = CxfEndpointUtils.getServerFactoryBean(serviceClass);
isWebServiceProvider = CxfEndpointUtils.hasAnnotation(serviceClass, WebServiceProvider.class);
svrBean.setAddress(endpoint.getAddress());
svrBean.setServiceClass(serviceClass);
if (endpoint.getServiceName() != null) {
svrBean.setServiceName(CxfEndpointUtils.getServiceName(endpoint));
}
if (endpoint.getPortName() != null) {
svrBean.setEndpointName(CxfEndpointUtils.getPortName(endpoint));
}
if (endpoint.getWsdlURL() != null) {
svrBean.setWsdlURL(endpoint.getWsdlURL());
}
}
DataFormat dataFormat = CxfEndpointUtils.getDataFormat(endpoint);
svrBean.setInvoker(new CamelInvoker(this));
// apply the feature here
if (!dataFormat.equals(DataFormat.POJO) && !isWebServiceProvider) {
List<AbstractFeature> features = new ArrayList<AbstractFeature>();
if (dataFormat.equals(DataFormat.PAYLOAD)) {
features.add(new PayLoadDataFormatFeature());
// adding the logging feature here for debug
//features.add(new LoggingFeature());
}
if (dataFormat.equals(DataFormat.MESSAGE)) {
features.add(new MessageDataFormatFeature());
//features.add(new LoggingFeature());
}
svrBean.setFeatures(features);
}
svrBean.setBus(bus);
svrBean.setStart(false);
server = svrBean.create();
}