for (EnterpriseBeanInfo bean : ejbJar.enterpriseBeans) {
if (bean instanceof StatelessBeanInfo) {
StatelessBeanInfo statelessBeanInfo = (StatelessBeanInfo) bean;
DeploymentInfo deploymentInfo = containerSystem.getDeploymentInfo(statelessBeanInfo.ejbDeploymentId);
if (deploymentInfo == null) continue;
PortInfo portInfo = ports.get(statelessBeanInfo.ejbName);
if (portInfo == null) continue;
try {
PortData port = WsBuilder.toPortData(portInfo, deploymentInfo.getInjections(), moduleBaseUrl, deploymentInfo.getClassLoader());
HttpListener container = createEjbWsContainer(moduleBaseUrl, port, deploymentInfo);
// 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(statelessBeanInfo.ejbDeploymentId, location);
ClassLoader classLoader = deploymentInfo.getClassLoader();
if (wsRegistry != null) {
// add servlet to web container
List<String> addresses = wsRegistry.addWsContainer(location, container, virtualHost, realmName, transportGuarantee, authMethod, classLoader);
// one of the registered addresses to be the connonical address
String address = selectSingleAddress(addresses);
// 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 CXF webservice for ejb " + deploymentInfo.getDeploymentID(), e);
}
}
}
}
for (WebAppInfo webApp : appInfo.webApps) {
WebDeploymentInfo deploymentInfo = containerSystem.getWebDeploymentInfo(webApp.moduleId);
if (deploymentInfo == null) continue;
Map<String,PortInfo> ports = new TreeMap<String,PortInfo>();
for (PortInfo port : webApp.portInfos) {
ports.put(port.serviceLink, port);
}
URL moduleBaseUrl = null;
try {
moduleBaseUrl = new File(webApp.codebase).toURL();
} catch (MalformedURLException e) {
logger.error("Invalid ejb jar location " + webApp.codebase, e);
}
for (ServletInfo servlet : webApp.servlets) {
PortInfo portInfo = ports.get(servlet.servletName);
if (portInfo == null) continue;
try {
ClassLoader classLoader = deploymentInfo.getClassLoader();
Collection<Injection> injections = deploymentInfo.getInjections();
Context context = deploymentInfo.getJndiEnc();
Class target = classLoader.loadClass(servlet.servletClass);
PortData port = WsBuilder.toPortData(portInfo, injections, moduleBaseUrl, classLoader);
HttpListener container = createPojoWsContainer(moduleBaseUrl, port, portInfo.serviceLink, target, context, webApp.contextRoot);