Newer Version Available
invalidateSessions()
Ends one or more sessions specified by a sessionId.
Syntax
1InvalidateSessionsResult = connection.invalidateSessions(string[] sessionIds);Usage
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.
Sample Code—Java
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.
1swfobject.registerObject("clippy.codeblock-1", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17public void invalidateSessionsSample(String[] sessionIds) {
18 try {
19 InvalidateSessionsResult[] results;
20 results = connection.invalidateSessions(sessionIds);
21 for (InvalidateSessionsResult result : results) {
22 // Check results for errors
23 if (!result.isSuccess()) {
24 if (result.getErrors().length > 0) {
25 System.out.println("Status code: "
26 + result.getErrors()[0].getStatusCode());
27 System.out.println("Error message: "
28 + result.getErrors()[0].getMessage());
29 }
30 } else {
31 System.out.println("Success.");
32 }
33 }
34 } catch (ConnectionException ce) {
35 ce.printStackTrace();
36 }
37}Sample Code—C#
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.
1swfobject.registerObject("clippy.codeblock-2", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17public void invalidateSessionsSample(string[] sessionIds)
18{
19 try
20 {
21 InvalidateSessionsResult[] results;
22 results = binding.invalidateSessions(sessionIds);
23 foreach (InvalidateSessionsResult result in results)
24 {
25 // Check results for errors
26 if (!result.success)
27 {
28 if (result.errors.Length > 0)
29 {
30 Console.WriteLine("Status code: " +
31 result.errors[0].statusCode);
32 Console.WriteLine("Error message: " +
33 result.errors[0].message);
34 }
35 }
36 else
37 {
38 Console.WriteLine("Success.");
39 }
40 }
41 }
42 catch (SoapException e)
43 {
44 Console.WriteLine("An unexpected error has occurred: " +
45 e.Message + "\n" + e.StackTrace);
46 }
47}Arguments
| Name | Type | Description |
|---|---|---|
| sessionIds | string[] | One or more sessionId strings. Limit 200. You can obtain your sessionId from the SessionHeader. |