reqData.setUsername("16c73ab6-b892-458f-abf5-2f875f74882e");
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
actions.add(new Integer(WSConstants.SIGN));
Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
handler.send(
WSConstants.SIGN, doc, reqData, actions, true
);
if (LOG.isDebugEnabled()) {
LOG.debug("After Signing....");
String outputString =
org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(doc);
LOG.debug(outputString);
}
msgContext = (java.util.Map<String, Object>)reqData.getMsgContext();
List<byte[]> savedSignatures =
(List<byte[]>)msgContext.get(WSHandlerConstants.SEND_SIGV);
assertTrue(savedSignatures != null && savedSignatures.size() == 1);
byte[] signatureValue = (byte[])savedSignatures.get(0);
assertTrue(signatureValue != null && signatureValue.length > 0);
//
// Verify the inbound request, and create a response with a Signature Confirmation
//
List<WSSecurityEngineResult> results = verify(doc);
actions.clear();
doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
msgContext = (java.util.Map<String, Object>)reqData.getMsgContext();
WSHandlerResult handlerResult = new WSHandlerResult(null, results);
List<WSHandlerResult> receivedResults = new ArrayList<WSHandlerResult>();
receivedResults.add(handlerResult);
msgContext.put(WSHandlerConstants.RECV_RESULTS, receivedResults);
handler.send(
WSConstants.NO_SECURITY, doc, reqData, actions, false
);
String outputString =
org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(doc);
if (LOG.isDebugEnabled()) {