public void login(String username, String password, URL jiraInstanceURL) throws AuthenticationException, CommunicationException, AuthorizationException, IllegalStateException { SoapObject loginRequest = SoapObjectBuilder.start() .withMethod("login") .withProperty("username", username) .withProperty("password", password) .build(); this.token = soap.execute(loginRequest, jiraInstanceURL, String.class); this.jiraInstanceURL = jiraInstanceURL; }
public void logout() throws IllegalStateException { SoapObject logoutRequest = SoapObjectBuilder.start().withMethod("logout").withProperty("token", token).build(); try { soap.execute(logoutRequest, this.jiraInstanceURL); } catch (CommunicationException e) { Log.w(TAG, "Communication exception during logout\n" + e); } catch (AuthorizationException e) { Log.w(TAG, "AuthorizationException during logout\n" + e); } catch (AuthenticationException e) { Log.w(TAG, "AuthenticationException during logout\n" + e); } finally { token = null; jiraInstanceURL = null; } }