String serviceName = desc.getWebserviceDescriptionName().getStringValue();
for (PortComponentType port : desc.getPortComponentArray()) {
PortInfo portInfo = new PortInfo();
String serviceLink = null;
ServiceImplBeanType beanType = port.getServiceImplBean();
if (beanType.getEjbLink() != null) {
serviceLink = beanType.getEjbLink().getStringValue();
} else if (beanType.getServletLink().getStringValue() != null) {
serviceLink = beanType.getServletLink().getStringValue();
}
portInfo.setServiceLink(serviceLink);
if (port.getServiceEndpointInterface() != null) {
String sei = port.getServiceEndpointInterface().getStringValue();
portInfo.setServiceEndpointInterfaceName(sei);
}
String portName = port.getPortComponentName().getStringValue();
portInfo.setPortName(portName);
portInfo.setProtocolBinding(port.getProtocolBinding());
portInfo.setServiceName(serviceName);
portInfo.setWsdlFile(wsdlFile);
if (port.getEnableMtom() != null) {
portInfo.setEnableMTOM(port.getEnableMtom().getBooleanValue());
}
if (port.getHandlerChains() != null) {
StringBuffer chains = new StringBuffer("<handler-chains xmlns=\"http://java.sun.com/xml/ns/javaee\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">");
chains.append(port.getHandlerChains().xmlText());
chains.append("</handler-chains>");
portInfo.setHandlersAsXML(chains.toString());
}
if (port.getWsdlPort() != null) {
portInfo.setWsdlPort(port.getWsdlPort().getQNameValue());
}
if (port.getWsdlService() != null) {
portInfo.setWsdlService(port.getWsdlService().getQNameValue());
}
String location = (String) correctedPortLocations.get(serviceLink);
portInfo.setLocation(location);
if (map == null) {
map = new HashMap<String, PortInfo>();
}