XMLElement endpointEl,
DescriptionElement desc,
ServiceElement parent)
throws WSDLException {
EndpointElement endpoint = parent.addEndpointElement();
String name = endpointEl.getAttributeValue(Constants.ATTR_NAME);
if(name != null)
{
endpoint.setName(new NCName(name));
}
QName bindingQN = null;
String binding = endpointEl.getAttributeValue(Constants.ATTR_BINDING);
if(binding != null)
{
try {
bindingQN = endpointEl.getQName(binding);
endpoint.setBindingName(bindingQN);
} catch (WSDLException e) {
getErrorReporter().reportError(
new ErrorLocatorImpl(), //TODO line&col nos.
"WSDL505",
new Object[] {binding, endpointEl.getQName()},
ErrorReporter.SEVERITY_ERROR);
}
}
String address = endpointEl.getAttributeValue(Constants.ATTR_ADDRESS);
if(address != null)
{
endpoint.setAddress(getURI(address));
}
parseExtensionAttributes(endpointEl, EndpointElement.class, endpoint, desc);
/* Parse the child elements of <endpoint>.
* As per WSDL 2.0 spec, they must be in the following order if present:
* <documentation>
* extension elements in any order
* TODO validate that the elements are in correct order
*/
XMLElement[] children = endpointEl.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, endpoint);
}
else
{
endpoint.addExtensionElement(
parseExtensionElement(EndpointElement.class, endpoint, tempEl, desc) );
}
}
return endpoint;