URL wsdlUrl = null;
if (wsdlLocation != null) {
try {
wsdlUrl = UriUtils.getWsdlUrl(new URI(wsdlLocation));
} catch (Exception e) {
throw new CamelException(e);
}
}
if (serviceQName == null) {
throw new CamelException(new Message("SVC_QNAME_NOT_FOUND_X", LOG, endpoint.getServiceName()).toString());
}
if (serviceClassName == null && dataFormat == DataFormat.POJO) {
throw new CamelException(new Message("SVC_CLASS_PROP_IS_REQUIRED_X", LOG).toString());
}
AbstractServiceFactoryBean serviceFactory = null;
try {
if (serviceClassName != null) {
Class<?> cls = ClassLoaderUtils.loadClass(serviceClassName, CxfEndpointUtils.class);
boolean isJSR181SEnabled = CxfEndpointUtils.hasWebServiceAnnotation(cls);
serviceFactory = isJSR181SEnabled
? new JaxWsServiceFactoryBean() : new ReflectionServiceFactoryBean();
serviceFactory.setBus(bus);
if (wsdlUrl != null) {
((ReflectionServiceFactoryBean)serviceFactory).setWsdlURL(wsdlUrl);
}
if (serviceQName != null) {
((ReflectionServiceFactoryBean)serviceFactory).setServiceName(serviceQName);
}
((ReflectionServiceFactoryBean)serviceFactory).setServiceClass(cls);
} else {
if (wsdlUrl == null) {
throw new CamelException(new Message("SVC_WSDL_URL_IS_NULL_X", LOG, wsdlLocation).toString());
}
serviceFactory = new WSDLServiceFactory(bus, wsdlUrl, serviceQName);
}
} catch (ClassNotFoundException cnfe) {
throw new CamelException(new Message("CLASS_X_NOT_FOUND ", LOG, serviceClassName).toString(), cnfe);
} catch (Exception e) {
throw new CamelException(e);
}
}