List of usage examples for javax.xml.ws.soap SOAPFaultException getMessage
public String getMessage()
From source file:com.palominolabs.crm.sf.soap.MetadataConnectionImplTest.java
License:asdf
private static void assertInvalidSession(ApiException e) { assertEquals("Call failed", e.getMessage()); Throwable cause = e.getCause(); assertTrue(cause instanceof SOAPFaultException); SOAPFaultException soapFaultException = (SOAPFaultException) cause; String expectedMsg = "INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session. Session not found, missing session key: "; String actualMsg = soapFaultException.getMessage(); assertEquals(expectedMsg, truncateSessionId(actualMsg)); SOAPFault fault = soapFaultException.getFault(); QName codeQname = fault.getFaultCodeAsQName(); assertEquals("INVALID_SESSION_ID", codeQname.getLocalPart()); String faultMsg = fault.getFaultString(); assertEquals(expectedMsg, truncateSessionId(faultMsg)); }
From source file:org.shredzone.cilla.ws.cxf.CillaRemoteAuthenticationProvider.java
@Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { if (!(authentication.getPrincipal() instanceof RemoteUserDetails)) { throw new InsufficientAuthenticationException( "authentication must contain a RemoteUserDetails principal"); }// ww w. j av a 2 s . c o m try { RemoteUserDetails userDetails = (RemoteUserDetails) authentication.getPrincipal(); List<GrantedAuthority> authorities = loginWs.authenticate().getRights().stream() .map(SimpleGrantedAuthority::new).collect(toList()); userDetails.setAuthorities(authorities); userDetails.setUser(userWs.fetchByLogin(userDetails.getUsername())); return new UsernamePasswordAuthenticationToken(userDetails, null, authorities); } catch (SOAPFaultException ex) { throw new BadCredentialsException(ex.getMessage()); } catch (CillaServiceException ex) { throw new AuthenticationServiceException("couldn't get user details", ex); } }
From source file:brugerautorisation.server.BrugerProtocol.java
private void cmd(List<String> msg) { OutputStreamWriter out = null; Writer writer = null;/*from www . ja va2 s .c o m*/ try { out = new OutputStreamWriter(server.getOutputStream()); writer = new BufferedWriter(out); switch (msg.get(0).toLowerCase().replace("\n", "")) { case ("hello"): break; case ("login"): System.out.println("v"); JSONObject json = new JSONObject(msg.get(1)); JSONObject json_return = new JSONObject(); try { Bruger b = ba.hentBruger(json.getString("username"), json.getString("password")); json_return.put("username", b.brugernavn); } catch (SOAPFaultException e) { json_return.put("error", e.getMessage()); } writer.write(json_return.toString()); writer.flush(); //out.flush(); break; case ("forgot_pass"): break; default: System.out.println("ikke fundet"); break; } } catch (IOException ex) { Logger.getLogger(BrugerProtocol.class.getName()).log(Level.SEVERE, null, ex); } catch (JSONException ex) { Logger.getLogger(BrugerProtocol.class.getName()).log(Level.SEVERE, null, ex); } finally { try { writer.close(); out.close(); } catch (IOException ex) { Logger.getLogger(BrugerProtocol.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:fi.koku.lok.UserSearchController.java
@RenderMapping(params = "action=searchUserParams") public String renderParams(PortletSession session, @RequestParam(value = "pic", required = false) String pic, @RequestParam(value = "picSelection", required = false) String picSelection, RenderRequest req, RenderResponse res, Model model) { User customer = null;//from w w w.ja v a2 s . co m // add logging mode for LOK to model boolean picCheck = false; // get user pic and role String userSessionPic = LogUtils.getPicFromSession(session); List<Role> userRoles = authorizationInfoService.getUsersRoles(LogConstants.COMPONENT_LOK, userSessionPic); // add a flag for allowing this user to see the operations on page // search.jsp if (AuthUtils.isOperationAllowed("AdminSystemLogFile", userRoles)) { model.addAttribute("allowedToView", true); } model.addAttribute("picType", picSelection == null ? DEFAULT_PIC : picSelection); // see http://fi.wikipedia.org/wiki/Henkil%C3%B6tunnus#Tunnuksen_muoto if (pic != null && pic.length() == 11 && (pic.charAt(6) == '-' || pic.charAt(6) == '+' || pic.charAt(6) == 'A')) { // pic is well formed picCheck = true; } if (picCheck) { try { customer = findUser(pic, userSessionPic, picSelection != null && picSelection.equals("customerPic")); } catch (ServiceFault fault) { if (fault.getMessage().equalsIgnoreCase("Customer not found.")) { model.addAttribute("error", "koku.lok.no.user.results"); } else { model.addAttribute("error", "koku.lok.error.customer"); } log.error("servicefault"); log.error(fault.getMessage()); } catch (SOAPFaultException e) { log.error("SOAPFaultException: " + e.getMessage()); model.addAttribute("error", "koku.lok.error.customer"); } if (customer != null) { model.addAttribute("searchedUsers", customer); model.addAttribute("foundName", customer.getSname() + " " + customer.getFname()); model.addAttribute("foundPic", customer.getPic()); } else { model.addAttribute("error", "koku.lok.no.user.results"); } } else { // pic is not well formed model.addAttribute("error", "koku.lok.malformed.pic"); } model.addAttribute("search", true); // This means that search was done return "usersearch"; }
From source file:test.integ.be.fedict.hsm.ws.WebServiceSecurityTest.java
@Test public void testMissingWSSecurityHeader() throws Exception { DigitalSignatureServicePortType dssPort = getPort(); ObjectFactory objectFactory = new ObjectFactory(); SignRequest signRequest = objectFactory.createSignRequest(); try {// w ww . ja va2 s . c o m dssPort.sign(signRequest); fail(); } catch (SOAPFaultException e) { LOG.debug("expected exception: " + e.getMessage()); // expected } assertEquals(1, getNumberOfSecurityAuditRecords()); }
From source file:test.integ.be.fedict.hsm.ws.WebServiceSecurityTest.java
@Test public void testWSSecurityTimestampOnly() throws Exception { DigitalSignatureServicePortType dssPort = getPort(); WSSecurityTestSOAPHandler securityTestSOAPHandler = new WSSecurityTestSOAPHandler(); securityTestSOAPHandler.addTimestamp(true); addSOAPHandler(securityTestSOAPHandler, dssPort); ObjectFactory objectFactory = new ObjectFactory(); SignRequest signRequest = objectFactory.createSignRequest(); try {//from w w w. j a va 2s . c om dssPort.sign(signRequest); fail(); } catch (SOAPFaultException e) { LOG.debug("expected exception: " + e.getMessage()); // expected } assertEquals(1, getNumberOfSecurityAuditRecords()); }
From source file:test.integ.be.fedict.hsm.ws.WebServiceSecurityTest.java
@Test public void testWSSecurityTS_BST() throws Exception { DigitalSignatureServicePortType dssPort = getPort(); KeyPair keyPair = HSMProxyTestCredential.generateKeyPair(); X509Certificate certificate = HSMProxyTestCredential.generateSelfSignedCertificate(keyPair); WSSecurityTestSOAPHandler securityTestSOAPHandler = new WSSecurityTestSOAPHandler(); securityTestSOAPHandler.addTimestamp(true); securityTestSOAPHandler.addBinarySecurityToken(certificate); addSOAPHandler(securityTestSOAPHandler, dssPort); ObjectFactory objectFactory = new ObjectFactory(); SignRequest signRequest = objectFactory.createSignRequest(); try {/*from w w w . j av a 2s.c o m*/ dssPort.sign(signRequest); fail(); } catch (SOAPFaultException e) { LOG.debug("expected exception: " + e.getMessage()); // expected } assertEquals(1, getNumberOfSecurityAuditRecords()); }
From source file:test.integ.be.fedict.hsm.ws.WebServiceSecurityTest.java
@Test public void testEmptyWSSecurityHeader() throws Exception { DigitalSignatureServicePortType dssPort = getPort(); WSSecurityTestSOAPHandler securityTestSOAPHandler = new WSSecurityTestSOAPHandler(); addSOAPHandler(securityTestSOAPHandler, dssPort); ObjectFactory objectFactory = new ObjectFactory(); SignRequest signRequest = objectFactory.createSignRequest(); int auditCountBefore = getNumberOfSecurityAuditRecords(); LOG.debug("number of security audit records before invocation: " + auditCountBefore); try {/* w w w .jav a2 s. co m*/ dssPort.sign(signRequest); fail(); } catch (SOAPFaultException e) { LOG.debug("expected exception: " + e.getMessage()); // expected } int auditCountAfter = getNumberOfSecurityAuditRecords(); LOG.debug("number of security audit records after invocation: " + auditCountAfter); assertEquals(1, getNumberOfSecurityAuditRecords()); }
From source file:test.integ.be.fedict.hsm.ws.WebServiceSecurityTest.java
@Test public void testWSSecurityTS_BST_Signature() throws Exception { DigitalSignatureServicePortType dssPort = getPort(); KeyPair keyPair = HSMProxyTestCredential.generateKeyPair(); X509Certificate certificate = HSMProxyTestCredential.generateSelfSignedCertificate(keyPair); WSSecurityTestSOAPHandler securityTestSOAPHandler = new WSSecurityTestSOAPHandler(); securityTestSOAPHandler.addTimestamp(true); securityTestSOAPHandler.addBinarySecurityToken(certificate); securityTestSOAPHandler.addSignature(keyPair.getPrivate()); addSOAPHandler(securityTestSOAPHandler, dssPort); ObjectFactory objectFactory = new ObjectFactory(); SignRequest signRequest = objectFactory.createSignRequest(); try {//from www .j a v a 2 s . co m dssPort.sign(signRequest); fail(); } catch (SOAPFaultException e) { LOG.debug("expected exception: " + e.getMessage()); // expected } assertEquals(1, getNumberOfSecurityAuditRecords()); }
From source file:test.integ.be.fedict.hsm.ws.WebServiceSecurityTest.java
@Test public void testWSSecurity_SHA1DigestAlgoFails() throws Exception { DigitalSignatureServicePortType dssPort = getPort(); KeyPair keyPair = HSMProxyTestCredential.generateKeyPair(); X509Certificate certificate = HSMProxyTestCredential.generateSelfSignedCertificate(keyPair); WSSecurityTestSOAPHandler securityTestSOAPHandler = new WSSecurityTestSOAPHandler(); securityTestSOAPHandler.addTimestamp(true); securityTestSOAPHandler.addBinarySecurityToken(certificate); securityTestSOAPHandler.addSignature(keyPair.getPrivate()); securityTestSOAPHandler.setDigestAlgorithm(DigestMethod.SHA1); addSOAPHandler(securityTestSOAPHandler, dssPort); ObjectFactory objectFactory = new ObjectFactory(); SignRequest signRequest = objectFactory.createSignRequest(); try {//from w ww. j av a 2 s . com dssPort.sign(signRequest); fail(); } catch (SOAPFaultException e) { LOG.debug("expected exception: " + e.getMessage()); // expected } assertEquals(1, getNumberOfSecurityAuditRecords()); }