XMLElement operEl,
DescriptionElement desc,
InterfaceElement parent)
throws WSDLException {
InterfaceOperationElement oper = parent.addInterfaceOperationElement();
String name = operEl.getAttributeValue(Constants.ATTR_NAME);
if(name != null)
{
oper.setName(new NCName(name));
}
String style = operEl.getAttributeValue(Constants.ATTR_STYLE);
if(style != null)
{
List stringList = StringUtils.parseNMTokens(style);
String uriString = null;
Iterator it = stringList.iterator();
while(it.hasNext())
{
uriString = (String)it.next();
oper.addStyleURI(getURI(uriString));
}
}
String pat = operEl.getAttributeValue(Constants.ATTR_PATTERN);
if(pat != null)
{
oper.setPattern(getURI(pat));
}
parseExtensionAttributes(operEl, InterfaceOperationElement.class, oper, desc);
/* Parse the child elements of interface <operation>.
* As per WSDL 2.0 spec, they must be in the following order if present:
* <documentation>
* <input> <output> <infault> <outfault> or extension elements in any order
* TODO validate that the elements are in correct order
*/
XMLElement[] children = operEl.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, oper);
}
else if (Constants.Q_ELEM_INPUT.equals(tempElQN))
{
parseInterfaceMessageReference(tempEl, desc, oper);
}
else if (Constants.Q_ELEM_OUTPUT.equals(tempElQN))
{
parseInterfaceMessageReference(tempEl, desc, oper);
}
else if (Constants.Q_ELEM_INFAULT.equals(tempElQN))
{
parseInterfaceFaultReference(tempEl, desc, oper);
}
else if (Constants.Q_ELEM_OUTFAULT.equals(tempElQN))
{
parseInterfaceFaultReference(tempEl, desc, oper);
}
else
{
oper.addExtensionElement(
parseExtensionElement(InterfaceOperationElement.class, oper, tempEl, desc) );
}
}
return oper;