if (JavaUtils.isAssignableFrom(Provider.class, sepClass) == false)
throw new WebServiceException("Endpoint implementation does not implement javax.xml.ws.Provider: " + sepClass.getName());
// 5.4 Conformance (WebServiceProvider annotation): A Provider based service endpoint implementation
// MUST carry a WebServiceProvider annotation
WebServiceProvider anWebServiceProvider = (WebServiceProvider)sepClass.getAnnotation(WebServiceProvider.class);
if (anWebServiceProvider == null)
throw new WebServiceException("Cannot obtain @WebServiceProvider annotation from: " + sepClass.getName());
// 7.3 Conformance (WebServiceProvider and WebService): A class annotated with the WebServiceProvider
// annotation MUST NOT carry a WebService annotation
if (sepClass.isAnnotationPresent(WebService.class))
throw new WebServiceException("Provider cannot carry @WebService annotation: " + sepClass.getName());
WSDLUtils wsdlUtils = WSDLUtils.getInstance();
String name = wsdlUtils.getJustClassName(sepClass);
String serviceName = anWebServiceProvider.serviceName();
if (serviceName.length() == 0)
serviceName = name + "Service";
String targetNS = anWebServiceProvider.targetNamespace();
if (targetNS.length() == 0)
targetNS = wsdlUtils.getTypeNamespace(sepClass);
String portName = anWebServiceProvider.portName();
if (portName.length() == 0)
portName = name + "Port";
ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, new QName(targetNS, serviceName));
wsMetaData.addService(serviceMetaData);
// Setup the ServerEndpointMetaData
QName portQName = new QName(targetNS, portName);
QName portTypeQName = new QName(targetNS, name);
Endpoint ep = dep.getService().getEndpointByName(linkName);
ServerEndpointMetaData sepMetaData = new ServerEndpointMetaData(serviceMetaData, ep, portQName, portTypeQName, Type.JAXWS);
sepMetaData.setLinkName(linkName);
sepMetaData.setStyle(Style.DOCUMENT);
sepMetaData.setParameterStyle(ParameterStyle.BARE);
sepMetaData.setServiceEndpointImplName(sepClass.getName());
sepMetaData.setServiceEndpointInterfaceName(sepClass.getName());
ServiceMode anServiceMode = sepClass.getAnnotation(ServiceMode.class);
sepMetaData.setServiceMode(anServiceMode != null ? anServiceMode.value() : Mode.PAYLOAD);
serviceMetaData.addEndpoint(sepMetaData);
// Process invoke method
processInvokeMethod(sepMetaData);
// Process WSDL
String wsdlLocation = anWebServiceProvider.wsdlLocation();
if (wsdlLocation.length() > 0)
{
URL wsdlURL = dep.getMetaDataFileURL(wsdlLocation);
serviceMetaData.setWsdlLocation(wsdlURL);
}