Newer Version Available

This content describes an older version of this product. View Latest

logout()

Ends the session of the logged-in user.

Syntax

1connection.logout();

Usage

This call ends the session for the logged-in user issuing the call. No arguments are needed.

To end one or more sessions started by someone other than the logged-in user, see invalidateSessions().

Sample Code—Java

This sample calls logout() to log the current user out and writes a message to the console.

1public void logoutSample() {
2   try {
3      connection.logout();
4      System.out.println("Logged out.");
5   } catch (ConnectionException ce) {
6      ce.printStackTrace();
7   }
8}

Sample Code—C#

This sample calls logout() to log the current user out and writes a message to the console.

1public void logoutSample()
2{
3   try
4   {
5      binding.logout();
6      Console.WriteLine("Logged out.");
7   }
8   catch (SoapException e)
9   {
10      Console.WriteLine("An unexpected error has occurred: " +
11                                 e.Message + "\n" + e.StackTrace);
12   }
13}

Arguments

This call uses no arguments. It ends the session for the logged-in user issuing the call, so no arguments are needed. The logged-in user is identified by the sessionId specified in the SessionHeader for this call.

Response

Void is returned. Because failure of the call means that the session has already been logged out, no results are needed. Any unexpected error, such as system unavailability, throws an error that should be handled by your client application.