1 16 17 package org.apache.axis.utils; 18 19 import org.apache.axis.components.logger.LogFactory; 20 import org.apache.axis.Constants; 21 import org.apache.commons.logging.Log; 22 23 import javax.wsdl.Port; 24 import javax.wsdl.extensions.soap.SOAPAddress; 25 import javax.wsdl.extensions.UnknownExtensibilityElement; 26 import javax.xml.namespace.QName ; 27 import java.util.List ; 28 import java.util.ListIterator ; 29 30 31 public class WSDLUtils { 32 protected static Log log = 33 LogFactory.getLog(WSDLUtils.class.getName()); 34 35 38 public static String getAddressFromPort(Port p) { 39 List extensibilityList = p.getExtensibilityElements(); 41 for (ListIterator li = extensibilityList.listIterator(); li.hasNext();) { 42 Object obj = li.next(); 43 if (obj instanceof SOAPAddress) { 44 return ((SOAPAddress) obj).getLocationURI(); 45 } else if (obj instanceof UnknownExtensibilityElement){ 46 UnknownExtensibilityElement unkElement = (UnknownExtensibilityElement) obj; 48 QName name = unkElement.getElementType(); 49 if(name.getNamespaceURI().equals(Constants.URI_WSDL12_SOAP) && 50 name.getLocalPart().equals("address")) { 51 return unkElement.getElement().getAttribute("location"); 52 } 53 } 54 } 55 return null; 57 } 59 } | Popular Tags |