reqData.setMsgContext(config);
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
actions.add(WSConstants.SIGN);
final Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
handler.send(
action,
doc,
reqData,
actions,
true
);
String outputString =
org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(doc);
if (LOG.isDebugEnabled()) {
LOG.debug("Signed message:");
LOG.debug(outputString);
}
RequestData data = new RequestData();
WSSConfig newConfig = WSSConfig.getNewInstance();
newConfig.setWsiBSPCompliant(false);
data.setWssConfig(newConfig);
data.setSigCrypto(crypto);
WSSecurityEngine newSecEngine = new WSSecurityEngine();
Element elem = WSSecurityUtil.getSecurityHeader(doc, "");
List<WSSecurityEngineResult> results =
newSecEngine.processSecurityHeader(elem, data);
assertTrue(handler.checkResults(results, actions));
}