Ends one or more sessions specified by a sessionId.
InvalidateSessionsResult = binding.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) {
try {
InvalidateSessionsResult[] results;
results = binding.invalidateSessions(sessionIds);
for (InvalidateSessionsResult result : results) {
// check results for errors
if (!result.isSuccess()) {
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 (Exception e) {
// handle exception. We just print it out for sample purposes.
System.out.println("Unexpected error encountered while trying to logout:\n\n" +
e.getMessage());
}
}
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. |