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.
This sample invalidates a set of sessions. The method in this sample takes an array of session IDs passed in as String values. The method then calls invalidateSessions() with this array and then checks the results for any errors.
public void invalidateSessionsSample(String[] sessionIds) { try { InvalidateSessionsResult[] results; results = connection.invalidateSessions(sessionIds); for (InvalidateSessionsResult result : results) { // Check results for errors if (!result.isSuccess()) { if (result.getErrors().length > 0) { System.out.println("Status code: " + result.getErrors()[0].getStatusCode()); System.out.println("Error message: " + result.getErrors()[0].getMessage()); } } else { System.out.println("Success."); } } } catch (ConnectionException ce) { ce.printStackTrace(); } }
This sample invalidates a set of sessions. The method in this sample takes an array of session IDs passed in as String values. The method then calls invalidateSessions() with this array and then checks the results for any errors.
public void invalidateSessionsSample(string[] sessionIds) { try { InvalidateSessionsResult[] results; results = binding.invalidateSessions(sessionIds); foreach (InvalidateSessionsResult result in results) { // Check results for errors
if (!result.success) { if (result.errors.Length > 0) { Console.WriteLine("Status code: " + result.errors[0].statusCode); Console.WriteLine("Error message: " + result.errors[0].message); } } else { Console.WriteLine("Success."); } } } catch (SoapException e) { Console.WriteLine("An unexpected error has occurred: " + e.Message + "\n" + e.StackTrace); } }
| Name | Type | Description |
|---|---|---|
| sessionIds | string[] | One or more sessionId strings. Limit 200. You can obtain your sessionId from the SessionHeader. |