XMLElement bindOpEl,
DescriptionElement desc,
BindingElement parent)
throws WSDLException {
BindingOperationElement oper = parent.addBindingOperationElement();
QName refQN = null;
String ref = bindOpEl.getAttributeValue(Constants.ATTR_REF);
if(ref != null)
{
try {
refQN = bindOpEl.getQName(ref);
oper.setRef(refQN);
} catch (WSDLException e) {
getErrorReporter().reportError(
new ErrorLocatorImpl(), //TODO line&col nos.
"WSDL505",
new Object[] {ref, bindOpEl.getQName()},
ErrorReporter.SEVERITY_ERROR);
}
}
parseExtensionAttributes(bindOpEl, BindingOperationElement.class, oper, desc);
/* Parse the child elements of binding <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 = bindOpEl.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))
{
parseBindingMessageReference(tempEl, desc, oper);
}
else if (Constants.Q_ELEM_OUTPUT.equals(tempElQN))
{
parseBindingMessageReference(tempEl, desc, oper);
}
else if (Constants.Q_ELEM_INFAULT.equals(tempElQN))
{
parseBindingFaultReference(tempEl, desc, oper);
}
else if (Constants.Q_ELEM_OUTFAULT.equals(tempElQN))
{
parseBindingFaultReference(tempEl, desc, oper);
}
else
{
oper.addExtensionElement(
parseExtensionElement(BindingOperationElement.class, oper, tempEl, desc) );
}
}
return oper;