sign.setKeyIdentifierType(WSConstants.UT_SIGNING);
sign.setSignatureAlgorithm(XMLSignature.ALGO_ID_MAC_HMAC_SHA1);
log.info("Before signing....");
sign.build(doc, null, secHeader);
log.info("Before adding UsernameToken PW Text....");
builder.prependToHeader(secHeader);
Document signedDoc = doc;
Message signedMsg = (Message) SOAPUtil.toSOAPMessage(signedDoc);
if (log.isDebugEnabled()) {
log.debug("Message with UserNameToken PW Text:");
XMLUtils.PrettyElementToWriter(signedMsg.getSOAPEnvelope().getAsDOM(), new PrintWriter(System.out));