*/
public void testX509SignatureISSTR() throws Exception {
SOAPEnvelope envelope = null;
WSSignEnvelope builder = new WSSignEnvelope();
builder.setUserInfo("wss4jcert", "security");
// builder.setUserInfo("john", "keypass");
SOAPConstants soapConstants = WSSecurityUtil.getSOAPConstants(unsignedEnvelope.getAsDOM());
Vector parts = new Vector();
/*
* Set up to sign body and use STRTransorm to sign
* the signature token (e.g. X.509 certificate)
*/
WSEncryptionPart encP =
new WSEncryptionPart(
soapConstants.getBodyQName().getLocalPart(), // define the body
soapConstants.getEnvelopeURI(),
"Content");
parts.add(encP);
encP =
new WSEncryptionPart(
"STRTransform", // reserved word to use STRTransform
soapConstants.getEnvelopeURI(),
"Content");
parts.add(encP);
builder.setParts(parts);
builder.setKeyIdentifierType(WSConstants.ISSUER_SERIAL);
log.info("Before Signing STR IS....");
Document doc = unsignedEnvelope.getAsDocument();
Document signedDoc = builder.build(doc, crypto);
Message signedMsg = (Message) AxisUtil.toSOAPMessage(signedDoc);
if (log.isDebugEnabled()) {
log.debug("Signed message with STR IssuerSerial key identifier:");
XMLUtils.PrettyElementToWriter(signedMsg.getSOAPEnvelope().getAsDOM(), new PrintWriter(System.out));