if(dataRef == null || dataRef.getXpath() == null) {
continue;
}
try {
XPath xp = new AXIOMXPath(dataRef.getXpath());
Iterator nsIter = namespaces.iterator();
while (nsIter.hasNext())
{
OMNamespace tmpNs = (OMNamespace)nsIter.next();
xp.addNamespace(tmpNs.getPrefix(), tmpNs.getNamespaceURI());
}
Iterator nodesIterator = xp.selectNodes(envelope).iterator();
while (nodesIterator.hasNext()) {
decryptedElements.put(nodesIterator.next(), Boolean.valueOf(dataRef.isContent()));
}
} catch (JaxenException e) {
// This has to be changed to propagate an instance of a RampartException up
throw new RampartException("An error occurred while searching for decrypted elements.", e);
}
}
//Check for encrypted body
if(rpd.isEncryptBody()&& !rpd.isEncryptBodyOptional()) {
if( !isRefIdPresent(encrRefs, data.getBodyEncrDataId())){
throw new RampartException("encryptedPartMissing",
new String[]{data.getBodyEncrDataId()});
}
}
for (int i = 0 ; i < encryptedParts.size() ; i++) {
WSEncryptionPart encPart = (WSEncryptionPart)encryptedParts.get(i);
//This is the encrypted Body and we already checked encrypted body
if (encPart.getType() == WSConstants.PART_TYPE_BODY) {
continue;
}
if ((WSConstants.SIG_LN.equals(encPart.getName()) &&
WSConstants.SIG_NS.equals(encPart.getNamespace()))
|| encPart.getType() == WSConstants.PART_TYPE_HEADER ) {
if (!isRefIdPresent(encrRefs, new QName(encPart.getNamespace(),encPart.getName()))) {
throw new RampartException("encryptedPartMissing",
new String[]{encPart.getNamespace()+":"+encPart.getName()});
}
continue;
}
// it is not a header or body part... verify encrypted xpath elements
String xpath = encPart.getXpath();
boolean found = false;
try {
XPath xp = new AXIOMXPath(xpath);
Iterator nsIter = namespaces.iterator();
while (nsIter.hasNext()) {
OMNamespace tmpNs = (OMNamespace) nsIter.next();
xp.addNamespace(tmpNs.getPrefix(), tmpNs.getNamespaceURI());
}
Iterator nodesIterator = xp.selectNodes(envelope).iterator();
while (nodesIterator.hasNext()) {
Object result = decryptedElements.get(nodesIterator.next());
if (result != null &&
("Element".equals(encPart.getEncModifier())