public void invoke(MessageContext context) throws Exception { context.setProperty("TiempoInicial", new Long(System.currentTimeMillis())); Vector result = (Vector) context.getProperty(WSHandlerConstants.RECV_RESULTS); for (int i = 0; i < result.size(); i++) { WSHandlerResult res = (WSHandlerResult) result.get(i); for (int j = 0; j < res.getResults().size(); j++) { WSSecurityEngineResult secRes = (WSSecurityEngineResult) res.getResults().get(j); int action = secRes.getAction(); // USER TOKEN if ((action & WSConstants.UT) > 0) { WSUsernameTokenPrincipal principal = (WSUsernameTokenPrincipal) secRes.getPrincipal(); // Set user property to user from UT to allow response encryption context.setProperty(WSHandlerConstants.ENCRYPTION_USER, principal.getName()); // System.out.print("User : "******" password : "******"\n"); SOALocalGISLNWS localGISLNWS = new SOALocalGISLNWS(); Integer idUsuario = localGISLNWS.obtenerUsuario(principal.getName(), principal.getPassword(), context); if (idUsuario != null) { context.setProperty(WSHandlerConstants.USER, idUsuario); localGISLNWS.comprobarPermisoLogin(context); } } // SIGNATURE if ((action & WSConstants.SIGN) > 0) { X509Certificate cert = secRes.getCertificate(); X500Name principal = (X500Name) secRes.getPrincipal(); // Do something whith cert System.out.print("Signature for : " + principal.getCommonName()); } } } }