use of javax.xml.ws.WebServiceProvider in project jbossws-cxf by jbossws.
the class MetadataBuilder method createDDEndpoint.
protected DDEndpoint createDDEndpoint(Class<?> sepClass, ArchiveDeployment dep, Endpoint ep) {
WebService anWebService = sepClass.getAnnotation(WebService.class);
WebServiceProvider anWebServiceProvider = sepClass.getAnnotation(WebServiceProvider.class);
Class<?> seiClass = null;
String seiName;
String name = (anWebService != null) ? anWebService.name() : "";
if (name.length() == 0)
name = JavaUtils.getJustClassName(sepClass);
String serviceName = (anWebService != null) ? anWebService.serviceName() : anWebServiceProvider.serviceName();
if (serviceName.length() == 0) {
serviceName = JavaUtils.getJustClassName(sepClass) + "Service";
}
String serviceNS = (anWebService != null) ? anWebService.targetNamespace() : anWebServiceProvider.targetNamespace();
if (serviceNS.length() == 0)
serviceNS = getTypeNamespace(JavaUtils.getPackageName(sepClass));
String portName = (anWebService != null) ? anWebService.portName() : anWebServiceProvider.portName();
if (portName.length() == 0) {
portName = name + "Port";
}
String annWsdlLocation;
if (anWebService != null && anWebService.endpointInterface().length() > 0) {
seiName = anWebService.endpointInterface();
ClassLoader runtimeClassLoader = dep.getClassLoader();
if (null == runtimeClassLoader)
throw MESSAGES.runtimeLoaderCannotBeNull(dep);
try {
seiClass = runtimeClassLoader.loadClass(seiName);
} catch (ClassNotFoundException cnfe) {
throw new RuntimeException(cnfe);
}
WebService seiAnnotation = seiClass.getAnnotation(WebService.class);
if (seiAnnotation == null)
throw MESSAGES.webserviceAnnotationNotFound(seiName);
if (seiAnnotation.portName().length() > 0 || seiAnnotation.serviceName().length() > 0 || seiAnnotation.endpointInterface().length() > 0)
throw MESSAGES.webserviceAnnotationSEIAttributes(seiName);
annWsdlLocation = !"".equals(anWebService.wsdlLocation()) ? anWebService.wsdlLocation() : seiAnnotation.wsdlLocation();
} else {
annWsdlLocation = (anWebService != null) ? anWebService.wsdlLocation() : anWebServiceProvider.wsdlLocation();
}
DDEndpoint result = new DDEndpoint();
result.setId(ep.getShortName());
result.setAddress(SysPropUtils.expandSystemProperty(ep.getAddress()));
result.setImplementor(ep.getTargetBeanName());
result.setMtomEnabled(isMtomEnabled(ep.getTargetBeanClass()));
result.setEpClass(seiClass != null ? seiClass : sepClass);
result.setPortName(new QName(serviceNS, portName));
result.setServiceName(new QName(serviceNS, serviceName));
if (annWsdlLocation.length() > 0) {
result.setAnnotationWsdlLocation(annWsdlLocation);
}
return result;
}
Aggregations