Ends one or more sessions specified by a sessionId.
InvalidateSessionsResult = connection.invalidateSessions(string[] sessionIds);
Use this call to end one or more sessions.
You can also use logout() to end just one session, the session of the logged-in user.
public void invalidateSessions() { String[] sessionIds = new String[2]; sessionIds[0] = connection.getConfig().getSessionId(); // a vlaid session ID, but not for the current one sessionIds[1] = "00DD0000000FKDk!AQYAQPcBSDy8B1Zml.ZrOB_" + "6x0fjHaMGzUzHKEd_Sd3LVJDOEtjjG884DKBGn7cEu.5rMllkvq" + "QSD.DzHnvPAn4SBskeka5l"; try { InvalidateSessionsResult[] results = connection.invalidateSessions(sessionIds); for (InvalidateSessionsResult result : results) { // check results for errors if (result.isSuccess()) { System.out.println("Success."); } else { Error[] errors = result.getErrors(); if (errors.length > 0) { StatusCode code = errors[0].getStatusCode(); String message = errors[0].getMessage(); // handle error. We just print the first error // out for sample purposes. System.out.println("Error code: " + code); System.out.println("Error message: " + message); } } } } catch (ConnectionException ce) { ce.printStackTrace(); } }
public void InvalidateSessions(string [] sessionIds) { try { InvalidateSessionsResult[] results; results = binding.InvalidateSessions(sessionIds); for (InvalidateSessionsResult result in results) { // check results for errors if (!result.Success) { StatusCode code = result.Errors[0].StatusCode; string message = result.Errors[0].Message; // handle error ... } } } catch (Exception e) { Console.WriteLine("Unexpected error encountered while trying to logout:\n\n{0}", e.Message); // handle exception ... } }
| Name | Type | Description |
|---|---|---|
| sessionIds | string[] | One or more sessionId strings. Limit 200. You can obtain your sessionId from the SessionHeader. |