contextData.put("ejbJarId", ejbJar.moduleName);
for (EnterpriseBeanInfo bean : ejbJar.enterpriseBeans) {
if (bean instanceof StatelessBeanInfo || bean instanceof SingletonBeanInfo) {
BeanContext beanContext = containerSystem.getBeanContext(bean.ejbDeploymentId);
if (beanContext == null) continue;
PortInfo portInfo = ports.get(bean.ejbName);
if (portInfo == null) continue;
try {
PortData port = WsBuilder.toPortData(portInfo, beanContext.getInjections(), moduleBaseUrl, beanContext.getClassLoader());
HttpListener container = createEjbWsContainer(moduleBaseUrl, port, beanContext);
// generate a location if one was not assigned
String location = port.getLocation();
if (location == null) {
location = autoAssignWsLocation(bean, port, contextData, deploymentIdTemplate);
}
if (!location.startsWith("/")) location = "/" + location;
ejbLocations.put(bean.ejbDeploymentId, location);
ClassLoader classLoader = beanContext.getClassLoader();
if (wsRegistry != null) {
String auth = authMethod;
String realm = realmName;
String transport = transportGuarantee;
if ("BASIC".equals(portInfo.authMethod) || "DIGEST".equals(portInfo.authMethod) || "CLIENT-CERT".equals(portInfo.authMethod)) {
auth = portInfo.authMethod;
realm = portInfo.realmName;
transport = portInfo.transportGuarantee;
}
String context = webContextByEjb.get(bean.ejbClass);
if (context == null && !OLD_WEBSERVICE_DEPLOYMENT) {
context = ejbJar.moduleName;
}
List<String> addresses = wsRegistry.addWsContainer(context, location, container, virtualHost, realm, transport, auth, classLoader);
// one of the registered addresses to be the canonical address
String address = HttpUtil.selectSingleAddress(addresses);
if (address != null) {
// register wsdl location
portAddressRegistry.addPort(portInfo.serviceId, portInfo.wsdlService, portInfo.portId, portInfo.wsdlPort, portInfo.seiInterfaceName, address);
logger.info("Webservice(wsdl=" + address + ", qname=" + port.getWsdlService() + ") --> Ejb(id=" + portInfo.portId + ")");
ejbAddresses.put(bean.ejbDeploymentId, address);
}
}
} catch (Throwable e) {
logger.error("Error deploying JAX-WS Web Service for EJB " + beanContext.getDeploymentID(), e);
}
}
}
}
for (WebAppInfo webApp : appInfo.webApps) {