public void logout() throws LogonException {

    // Make sure user is already logged on before letting them logout
    if (!session.alreadyLoggedOn())
      throw new LogonException("You must first be logged on before calling Logout");

    LogoutRequest logoutRequest = new LogoutRequest();
    logoutRequest.setSessionId(session.getSessionId());

    LogoutResponse logoutResponse =
        (LogoutResponse) wsTemplate.marshalSendAndReceive(logoutRequest);
    System.out.println("logout response = " + logoutResponse.getStatus());
    session.wipe();
  }