WSSecHeader secHeader = new WSSecHeader();
secHeader.insertSecurityHeader(doc);
List<WSEncryptionPart> parts = new ArrayList<WSEncryptionPart>();
// Give wrong names to make sure it's picking up the element
WSEncryptionPart encP =
new WSEncryptionPart(
"Incorrect Localname",
"Incorrect N/S",
"");
Element bodyElement = WSSecurityUtil.findBodyElement(doc);
assertTrue(bodyElement != null && "Body".equals(bodyElement.getLocalName()));
encP.setElement(bodyElement);
parts.add(encP);
sign.setParts(parts);
Document signedDoc = sign.build(doc, crypto, secHeader);