try {
// 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());
endpoint.configure(svrBean);
//Need to set the service name and endpoint name to the ClientFactoryBean's service factory
// to walk around the issue of setting EndpointName and ServiceName
CxfEndpointBean cxfEndpointBean = endpoint.getCxfEndpointBean();
if (cxfEndpointBean.getServiceName() != null) {
svrBean.getServiceFactory().setServiceName(cxfEndpointBean.getServiceName());
}
if (cxfEndpointBean.getEndpointName() != null) {
svrBean.getServiceFactory().setEndpointName(cxfEndpointBean.getEndpointName());
}
} else { // setup the serverFactoryBean with the URI paraments
Class serviceClass = ClassLoaderUtils.loadClass(endpoint.getServiceClass(), this.getClass());
svrBean = CxfEndpointUtils.getServerFactoryBean(serviceClass);