Endpoint ep = dep.getService().getEndpointByName(linkName);
Class<?> seiClass = null;
String seiName;
WSDLUtils wsdlUtils = WSDLUtils.getInstance();
String name = (anWebService != null) ? anWebService.name() : "";
if (name.length() == 0)
name = WSDLUtils.getJustClassName(sepClass);
String serviceName = (anWebService != null) ? anWebService.serviceName() : anWebServiceProvider.serviceName();
if (serviceName.length() == 0)
serviceName = WSDLUtils.getJustClassName(sepClass) + "Service";
String serviceNS = (anWebService != null) ? anWebService.targetNamespace() : anWebServiceProvider.targetNamespace();
if (serviceNS.length() == 0)
serviceNS = wsdlUtils.getTypeNamespace(sepClass);
String portName = (anWebService != null) ? anWebService.portName() : anWebServiceProvider.portName();
if (portName.length() == 0)
portName = name + "Port";
String wsdlLocation = (anWebService != null) ? anWebService.wsdlLocation() : anWebServiceProvider.wsdlLocation();
String interfaceNS = serviceNS; // the default, but a SEI annotation may override this
if (anWebService != null && anWebService.endpointInterface().length() > 0)
{
seiName = anWebService.endpointInterface();
ClassLoader runtimeClassLoader = dep.getRuntimeClassLoader();
if(null == runtimeClassLoader)
throw new IllegalArgumentException("Runtime loader cannot be null");
seiClass = runtimeClassLoader.loadClass(seiName);
WebService seiAnnotation = seiClass.getAnnotation(WebService.class);
if (seiAnnotation == null)
throw new WSException("Interface does not have a @WebService annotation: " + seiName);
if (seiAnnotation.portName().length() > 0 || seiAnnotation.serviceName().length() > 0 || seiAnnotation.endpointInterface().length() > 0)
throw new WSException("@WebService cannot have attribute 'portName', 'serviceName', 'endpointInterface' on: " + seiName);
// Redefine the interface or "PortType" name
name = seiAnnotation.name();
if (name.length() == 0)
name = WSDLUtils.getJustClassName(seiClass);
interfaceNS = seiAnnotation.targetNamespace();
if (interfaceNS.length() == 0)
interfaceNS = wsdlUtils.getTypeNamespace(seiClass);
// The spec states that WSDL location should be allowed on an SEI, although it
// makes far more sense on the implementation bean, so we ONLY consider the SEI
// wsdlLocation when it is not defined on the bean already