in modules/rampart-core/src/main/java/org/apache/rampart/handler/RampartReceiver.java [78:143]
public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
if (!msgContext.isEngaged(WSSHandlerConstants.SECURITY_MODULE_NAME)) {
return InvocationResponse.CONTINUE;
}
if(mlog.isDebugEnabled()){
mlog.debug("*********************** RampartReceiver received \n"
+ msgContext.getEnvelope());
}
RampartEngine engine = new RampartEngine();
List<WSSecurityEngineResult> wsResult = null;
try {
wsResult = engine.process(msgContext);
} catch (WSSecurityException e) {
setFaultCodeAndThrowAxisFault(msgContext, e);
} catch (WSSPolicyException e) {
setFaultCodeAndThrowAxisFault(msgContext, e);
} catch (RampartException e) {
setFaultCodeAndThrowAxisFault(msgContext, e);
}
if(wsResult == null) {
return InvocationResponse.CONTINUE;
}
List<WSHandlerResult> results = null;
if ((results = (List<WSHandlerResult>) msgContext
.getProperty(WSHandlerConstants.RECV_RESULTS)) == null) {
results = new ArrayList<WSHandlerResult>();
msgContext.setProperty(WSHandlerConstants.RECV_RESULTS, results);
}
WSHandlerResult rResult = new WSHandlerResult("", wsResult, null);
results.add(0, rResult);
SOAPHeader header = null;
try {
header = msgContext.getEnvelope().getHeader();
} catch (OMException ex) {
throw new AxisFault(
"RampartReceiver: cannot get SOAP header after security processing",
ex);
}
Iterator headers = header.getChildElements();
SOAPHeaderBlock headerBlock = null;
while (headers.hasNext()) { // Find the wsse header
SOAPHeaderBlock hb = (SOAPHeaderBlock) headers.next();
if (hb.getLocalName().equals(WSConstants.WSSE_LN)
&& hb.getNamespace().getNamespaceURI().equals(WSConstants.WSSE_NS)) {
headerBlock = hb;
break;
}
}
if(headerBlock != null) {
headerBlock.setProcessed();
}
return InvocationResponse.CONTINUE;
}