/*
* If we are the requestor, then this means we are making an external web service
* call and need to check if we need to set credentials before the call is made.
*/
if (Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE))) {
WebServiceInvocationCredentials parameters = WebServiceInvocationCredentialsHolder.get();
if (parameters != null && parameters.isAuthenticationWsSecurity()) {
Map props = new HashMap();
props.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
props.put(WSHandlerConstants.USER, parameters.getUserId());
props.put(WSHandlerConstants.PASSWORD_TYPE, parameters.isHashPassword() ? WSConstants.PW_DIGEST : WSConstants.PW_TEXT);
props.put(WSHandlerConstants.PW_CALLBACK_REF, new ApplyCredentialsHandler());
WSS4JOutInterceptor wss4jInHandler = new WSS4JOutInterceptor(props);
message.getInterceptorChain().add(wss4jInHandler);