* @param parents A list of parents of the SOAP header element.
* @param valInfo The validation info for this validation.
*/
protected void validateHeader(Object element, List parents, IWSDL11ValidationInfo valInfo)
{
SOAPHeaderImpl soapHeader = (SOAPHeaderImpl)element;
QName messageQName = soapHeader.getMessage();
Message message = ((Definition)parents.get(parents.size() - 1)).getMessage(messageQName);
if (message == null)
{
// message undefined
valInfo.addError(
messagegenerator.getString(_ERROR_HEADER_MESSAGE_UNDEFINED, QUOTE + messageQName.getLocalPart() + QUOTE), soapHeader);
}
else
{
String partname = soapHeader.getPart();
Part part = message.getPart(partname);
if (part == null)
{
// part undefined
valInfo.addError(
messagegenerator.getString(
_ERROR_HEADER_PART_UNDEFINED,
QUOTE + partname + QUOTE,
QUOTE + messageQName.getLocalPart() + QUOTE), soapHeader);
}
}
String use = soapHeader.getUse();
if (use != null && !use.equalsIgnoreCase(LITERAL) && !use.equalsIgnoreCase(ENCODED))
{
// use undefined
valInfo.addError(
messagegenerator.getString(_ERROR_HEADER_USE_UNDEFINED, QUOTE + use + QUOTE), soapHeader);
}
if (use.equalsIgnoreCase(ENCODED))
{
List encodingStyles = soapHeader.getEncodingStyles();
if (encodingStyles == null || encodingStyles.isEmpty())
{
// no encodingStyle defined
valInfo.addError(messagegenerator.getString(_ERROR_HEADER_ENCODINGSTYLE_UNDEFINED), soapHeader);
}
String namespace = soapHeader.getNamespaceURI();
if (namespace == null || namespace.equalsIgnoreCase(EMPTY_STRING))
{
// no namespace defined
valInfo.addError(messagegenerator.getString(_ERROR_HEADER_NAMESPACE_UNDEFINED), soapHeader);
}
}
List headerFaults = soapHeader.getSOAPHeaderFaults();
if (headerFaults != null)
{
Iterator iheaderFaults = headerFaults.iterator();
while (iheaderFaults.hasNext())
{