XMLElement msgRefEl,
DescriptionElement desc,
InterfaceOperationElement parent)
throws WSDLException {
InterfaceMessageReferenceElement message = parent.addInterfaceMessageReferenceElement();
if(Constants.ELEM_INPUT.equals(msgRefEl.getLocalName())) {
message.setDirection(Direction.IN);
}
else if(Constants.ELEM_OUTPUT.equals(msgRefEl.getLocalName())) {
message.setDirection(Direction.OUT);
}
String msgLabel = msgRefEl.getAttributeValue(Constants.ATTR_MESSAGE_LABEL);
if(msgLabel != null)
{
message.setMessageLabel(new NCName(msgLabel));
}
else
{
//This is a limited solution supporting the 3 MEPs in the Part 2 spec.
//TODO generic support for user-defined, extensible MEPs.
if(message.getDirection().equals(Direction.IN))
{
message.setMessageLabel(MessageLabel.IN);
}
else
{
message.setMessageLabel(MessageLabel.OUT);
}
}
String element = msgRefEl.getAttributeValue(Constants.ATTR_ELEMENT);
if(element != null)
{
if(element.equals(Constants.NMTOKEN_ANY)) {
message.setElement(QNameTokenUnion.ANY);
} else if(element.equals(Constants.NMTOKEN_NONE)) {
message.setElement(QNameTokenUnion.NONE);
} else if(element.equals(Constants.NMTOKEN_OTHER)) {
message.setElement(QNameTokenUnion.OTHER);
} else {
//It is not one of the allowed xs:Token values, so it must be an xs:QName
try {
QNameTokenUnion qname = new QNameTokenUnion(msgRefEl.getQName(element));
message.setElement(qname);
} catch (WSDLException e) {
getErrorReporter().reportError(
new ErrorLocatorImpl(), //TODO line&col nos.
"WSDL505",
new Object[] {element, msgRefEl.getQName()},
ErrorReporter.SEVERITY_ERROR);
}
}
}
parseExtensionAttributes(msgRefEl, InterfaceMessageReferenceElement.class, message, desc);
XMLElement[] children = msgRefEl.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, message);
}
else
{
message.addExtensionElement(
parseExtensionElement(InterfaceMessageReferenceElement.class, message, tempEl, desc) );
}
}
return message;