// TODO else { /* create webserviceDescription name using some sort of jaxrpc data */ }
webservices.getWebserviceDescription().add(webserviceDescription);
}
// add a port component if we don't alrady have one
PortComponent portComponent = portMap.get(sessionBean.getEjbName());
if (portComponent == null) {
portComponent = new PortComponent();
if (webserviceDescription.getPortComponentMap().containsKey(JaxWsUtils.getPortQName(ejbClass).getLocalPart())) {
// when to webservices.xml is defined and when we want to
// publish more than one port for the same implementation by configuration
portComponent.setPortComponentName(sessionBean.getEjbName());
} else { // JAX-WS Metadata specification default
portComponent.setPortComponentName(JaxWsUtils.getPortQName(ejbClass).getLocalPart());
}
webserviceDescription.getPortComponent().add(portComponent);
final ServiceImplBean serviceImplBean = new ServiceImplBean();
serviceImplBean.setEjbLink(sessionBean.getEjbName());
portComponent.setServiceImplBean(serviceImplBean);
// Checking if MTOM must be enabled
if (portComponent.getProtocolBinding() == null) {
portComponent.setProtocolBinding(JaxWsUtils.getBindingUriFromAnn(ejbClass));
}
configMtomAnnotation(ejbClass, portComponent);
if (SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(portComponent.getProtocolBinding()) ||
SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(portComponent.getProtocolBinding())) {
portComponent.setEnableMtom(true);
}
}
// default portId == deploymentId
if (portComponent.getId() == null) {
portComponent.setId(deployment.getDeploymentId());
}
if (webserviceDescription.getId() == null) {
webserviceDescription.setId(deployment.getDeploymentId());
}
// set service endpoint interface
if (portComponent.getServiceEndpointInterface() == null) {
portComponent.setServiceEndpointInterface(sessionBean.getServiceEndpoint());
}
// default location is /@WebService.serviceName/@WebService.name
if (JaxWsUtils.isWebService(ejbClass)) {
if (portComponent.getWsdlPort() == null) {
portComponent.setWsdlPort(JaxWsUtils.getPortQName(ejbClass));
}
if (webserviceDescription.getWsdlFile() == null) {
webserviceDescription.setWsdlFile(JaxWsUtils.getServiceWsdlLocation(ejbClass, ejbModule.getClassLoader()));
}
if (portComponent.getWsdlService() == null) {
final Definition definition = getWsdl(ejbModule, webserviceDescription.getWsdlFile());
if (definition != null && definition.getServices().size() == 1) {
final QName serviceQName = (QName) definition.getServices().keySet().iterator().next();
portComponent.setWsdlService(serviceQName);
} else {
portComponent.setWsdlService(JaxWsUtils.getServiceQName(ejbClass));
}
}
if (portComponent.getLocation() == null && webserviceDescription.getWsdlFile() != null) {
// set location based on wsdl port
final Definition definition = getWsdl(ejbModule, webserviceDescription.getWsdlFile());
final String locationURI = getLocationFromWsdl(definition, portComponent);
portComponent.setLocation(locationURI);
}
if (portComponent.getProtocolBinding() == null) {
portComponent.setProtocolBinding(JaxWsUtils.getBindingUriFromAnn(ejbClass));
}
// handlers
if (portComponent.getHandlerChains() == null) {
final HandlerChains handlerChains = getHandlerChains(ejbClass, sessionBean.getServiceEndpoint(), ejbModule.getClassLoader());
portComponent.setHandlerChains(handlerChains);
}
}
// TODO else { /* location JAX-RPC services comes from wsdl file */ }
}