if(portName == null) {
portName = "";
}
// Check if the same endpoint is already defined in webservices.xml
WebServicesDescriptor wsDesc = bundleDesc.getWebServices();
WebServiceEndpoint endpoint = wsDesc.getEndpointByName(portComponentName);
WebService newWS;
if(endpoint == null) {
// Check if a service with the same name is already present
// If so, add this endpoint to the existing service
if (svcName.length()!=0) {
newWS = wsDesc.getWebServiceByName(svcName);
} else {
newWS = wsDesc.getWebServiceByName(((Class)annElem).getSimpleName()+"Service");
}
if(newWS==null) {
newWS = new WebService();
// service name from annotation
if (svcName.length()!=0) {
newWS.setName(svcName);
} else {
newWS.setName(((Class)annElem).getSimpleName()+"Service");
}
wsDesc.addWebService(newWS);
}
endpoint = new WebServiceEndpoint();
// port-component-name is fully qualified class name
endpoint.setEndpointName(portComponentName);
newWS.addEndpoint(endpoint);
wsDesc.setSpecVersion(com.sun.enterprise.deployment.node.WebServicesDescriptorNode.SPEC_VERSION);
} else {
newWS = endpoint.getWebService();
}
// If wsdl-service is specified in the descriptor, then the targetnamespace