builder.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
builder.setSymmetricEncAlgorithm(WSConstants.TRIPLE_DES);
Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
WSSecHeader secHeader = new WSSecHeader();
secHeader.insertSecurityHeader(doc);
Crypto wssCrypto = CryptoFactory.getInstance("wss40.properties");
Document encryptedDoc = builder.build(doc, wssCrypto, secHeader);
Element body = WSSecurityUtil.findBodyElement(doc);
Element encryptionMethod =
WSSecurityUtil.findElement(body, "EncryptionMethod", WSConstants.ENC_NS);