{
log.debug("START buildMetaData: [name=" + dep.getCanonicalName() + "]");
try
{
// For every webservice-description build the ServiceMetaData
UnifiedMetaData wsMetaData = new UnifiedMetaData(dep.getRootFile());
wsMetaData.setDeploymentName(dep.getCanonicalName());
ClassLoader runtimeClassLoader = dep.getRuntimeClassLoader();
if(null == runtimeClassLoader)
throw new IllegalArgumentException("Runtime loader cannot be null");
wsMetaData.setClassLoader(runtimeClassLoader);
WebservicesMetaData jaxrpcMapping = dep.getAttachment(WebservicesMetaData.class);
WebserviceDescriptionMetaData[] wsDescriptionArr = jaxrpcMapping.getWebserviceDescriptions();
for (WebserviceDescriptionMetaData wsdMetaData : wsDescriptionArr)
{
ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, null);
serviceMetaData.setWebserviceDescriptionName(wsdMetaData.getWebserviceDescriptionName());
wsMetaData.addService(serviceMetaData);
// Set wsdl file
String wsdlFile = wsdMetaData.getWsdlFile();
serviceMetaData.setWsdlFile(wsdlFile);
// Unmarshall the WSDL
WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
// Unmarshall the jaxrpc-mapping.xml
String mappingFile = wsdMetaData.getJaxrpcMappingFile();
serviceMetaData.setMappingLocation(dep.getMetaDataFileURL(mappingFile));
JavaWsdlMapping javaWsdlMapping = serviceMetaData.getJavaWsdlMapping();
if (javaWsdlMapping == null)
throw new WSException("jaxrpc-mapping-file not configured from webservices.xml");
// Build type mapping meta data
setupTypesMetaData(serviceMetaData);
// Assign the WS-Security configuration,
WSSecurityConfigFactory wsseConfFactory = WSSecurityConfigFactory.newInstance();
WSSecurityConfiguration securityConfiguration = wsseConfFactory.createConfiguration(wsMetaData.getRootFile(), WSSecurityOMFactory.SERVER_RESOURCE_NAME);
serviceMetaData.setSecurityConfiguration(securityConfiguration);
// For every port-component build the EndpointMetaData
PortComponentMetaData[] pcMetaDataArr = wsdMetaData.getPortComponents();
for (PortComponentMetaData pcMetaData : pcMetaDataArr)
{
String linkName = pcMetaData.getEjbLink() != null ? pcMetaData.getEjbLink() : pcMetaData.getServletLink();
QName portName = pcMetaData.getWsdlPort();
// JBWS-722
// <wsdl-port> in webservices.xml should be qualified
if (portName.getNamespaceURI().length() == 0)
{
String nsURI = wsdlDefinitions.getTargetNamespace();
portName = new QName(nsURI, portName.getLocalPart());
log.warn("Adding wsdl targetNamespace to: " + portName);
pcMetaData.setWsdlPort(portName);
}
WSDLEndpoint wsdlEndpoint = getWsdlEndpoint(wsdlDefinitions, portName);
if (wsdlEndpoint == null)
throw new WSException("Cannot find port in wsdl: " + portName);
// set service name
serviceMetaData.setServiceName(wsdlEndpoint.getWsdlService().getName());
QName interfaceQName = wsdlEndpoint.getInterface().getName();
Endpoint ep = dep.getService().getEndpointByName(linkName);
ServerEndpointMetaData sepMetaData = new ServerEndpointMetaData(serviceMetaData, ep, portName, interfaceQName, Type.JAXRPC);
sepMetaData.setPortComponentName(pcMetaData.getPortComponentName());
sepMetaData.setLinkName(linkName);
serviceMetaData.addEndpoint(sepMetaData);
initEndpointEncodingStyle(sepMetaData);
initEndpointAddress(dep, sepMetaData);
initEndpointBinding(wsdlEndpoint, sepMetaData);
EJBArchiveMetaData apMetaData = dep.getAttachment(EJBArchiveMetaData.class);
JSEArchiveMetaData webMetaData = dep.getAttachment(JSEArchiveMetaData.class);
if (apMetaData != null)
{
wsMetaData.setSecurityDomain(apMetaData.getSecurityDomain());
// Copy the wsdl publish location from jboss.xml
String wsdName = serviceMetaData.getWebserviceDescriptionName();
String wsdlPublishLocation = apMetaData.getWsdlPublishLocationByName(wsdName);
serviceMetaData.setWsdlPublishLocation(wsdlPublishLocation);
// Copy <port-component> meta data
EJBMetaData bmd = apMetaData.getBeanByEjbName(linkName);
if (bmd == null)
throw new WSException("Cannot obtain UnifiedBeanMetaData for: " + linkName);
String configName = apMetaData.getConfigName();
String configFile = apMetaData.getConfigFile();
if (configName != null || configFile != null)
sepMetaData.setConfigName(configName, configFile);
EJBSecurityMetaData smd = bmd.getSecurityMetaData();
if (smd != null)
{
String authMethod = smd.getAuthMethod();
sepMetaData.setAuthMethod(authMethod);
String transportGuarantee = smd.getTransportGuarantee();
sepMetaData.setTransportGuarantee(transportGuarantee);
Boolean secureWSDLAccess = smd.getSecureWSDLAccess();
sepMetaData.setSecureWSDLAccess(secureWSDLAccess);
}
}
else if (webMetaData != null)
{
wsMetaData.setSecurityDomain(webMetaData.getSecurityDomain());
String targetBean = webMetaData.getServletClassNames().get(linkName);
sepMetaData.setServiceEndpointImplName(targetBean);
// Copy the wsdl publish location from jboss-web.xml