Map<String, PortInfo> map = new HashMap<String, PortInfo>();
try {
InputStream in = wsDDUrl.openStream();
if (in == null) {
throw new DeploymentException("unable to read descriptor " + wsDDUrl);
}
Unmarshaller unmarshaller = getJAXBContext().createUnmarshaller();
Object obj = unmarshaller.unmarshal(in);
WebservicesType wst = null;
if (obj instanceof JAXBElement) {
wst = (WebservicesType)((JAXBElement)obj).getValue();
}
for (WebserviceDescriptionType desc : wst.getWebserviceDescription()) {
final String wsdlFile = desc.getWsdlFile().getValue();
final String serviceName = desc.getWebserviceDescriptionName().getValue();
for (PortComponentType port : desc.getPortComponent()) {
String servlet = port.getServiceImplBean().getServletLink().getValue();
String sei = port.getServiceEndpointInterface().getValue();
String portName = port.getPortComponentName().getValue();
PortInfo portInfo = new PortInfo();
portInfo.setServiceName(serviceName);
portInfo.setServletLink(servlet);
portInfo.setServiceEndpointInterfaceName(sei);
portInfo.setPortName(portName);
portInfo.setWsdlFile(wsdlFile);
portInfo.setHandlers(port.getHandler());
map.put(servlet, portInfo);
}
}
return map;
} catch (IOException ex) {
ex.printStackTrace();
throw new DeploymentException("unable to read " + wsDDUrl, ex);
} catch (JAXBException ex) {
ex.printStackTrace();
throw new DeploymentException("unable to parse webservices.xml", ex);
}
}