// Getting a value of this reference
String ref = elem.getFirstChild() == null ? null
: elem.getFirstChild().getNodeValue();
// If the value is invalid, the assertion failed
if (ref == null)
throw new AssertionFailException("The element " + elem.getNodeName()
+ " of the ref:swaRef schema type is specified, but its vaule"
+ " is invalid.");
// If the URI does not start with the "cid:" content-id prefix
// The assertion failed
if (!ref.startsWith("cid:"))
{
throw new AssertionFailException("The URI " + ref
+ " of the ref:swaRef schema type must use the cid: prefix.");
}
boolean refFound = false;
Iterator iMimeParts = mimeParts.getParts().iterator();
// Going through all the MIME parts of the SOAP message
while (iMimeParts.hasNext())
{
MimePart mimePart = (MimePart)iMimeParts.next();
// Getting part's Content-ID header
String cid = MIMEUtils.getMimeHeaderAttribute(
mimePart.getHeaders(), MIMEConstants.HEADER_CONTENT_ID);
if (cid != null)
{
// If the header value equals the reference URI,
// the corresponding MIME part is found
if (cid.equals('<' + ref.substring(4) + '>'))
{
refFound = true;
break;
}
}
}
// If the corresponding MIME part is not found
// the assertion failed
if (!refFound)
throw new AssertionFailException("The SOAP message does not contain"
+ " a MIME part with the <" + ref.substring(4) + "> Content-ID.");
}
}
}
catch (AssertionNotApplicableException anae)