private InterfaceElement parseInterface(
XMLElement interfaceEl,
DescriptionElement desc)
throws WSDLException {
InterfaceElement intface = desc.addInterfaceElement();
String name = interfaceEl.getAttributeValue(Constants.ATTR_NAME);
if(name != null)
{
intface.setName(new NCName(name));
}
String styleDefault = interfaceEl.getAttributeValue(Constants.ATTR_STYLE_DEFAULT);
if(styleDefault != null)
{
List stringList = StringUtils.parseNMTokens(styleDefault);
String uriString = null;
Iterator it = stringList.iterator();
while(it.hasNext())
{
uriString = (String)it.next();
intface.addStyleDefaultURI(getURI(uriString));
}
}
String extendsAtt = interfaceEl.getAttributeValue(Constants.ATTR_EXTENDS);
if(extendsAtt != null)
{
List stringList = StringUtils.parseNMTokens(extendsAtt);
String qnString = null;
Iterator it = stringList.iterator();
while(it.hasNext())
{
qnString = (String)it.next();
intface.addExtendedInterfaceName(interfaceEl.getQName(qnString));
}
}
parseExtensionAttributes(interfaceEl, InterfaceElement.class, intface, desc);
/* Parse the child elements of <interface>.
* As per WSDL 2.0 spec, they must be in the following order if present:
* <documentation>
* <fault> <operation> or extension elements in any order
* TODO validate that the elements are in correct order
*/
XMLElement[] children = interfaceEl.getChildElements();
XMLElement tempEl = null;
QName tempElQN = null;
for(int i=0; i<children.length; i++)
{
tempEl = children[i];
tempElQN = tempEl.getQName();
if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
{
parseDocumentation(tempEl, desc, intface);
}
else if (Constants.Q_ELEM_FAULT.equals(tempElQN))
{
parseInterfaceFault(tempEl, desc, intface);
}
else if (Constants.Q_ELEM_OPERATION.equals(tempElQN))
{
parseInterfaceOperation(tempEl, desc, intface);
}
else
{
intface.addExtensionElement(
parseExtensionElement(InterfaceElement.class, intface, tempEl, desc) );
}
}
return intface;