Sessions sample (Cocoa)

This sample shows how to work with sessions. Session variables are uploaded to the server and then retrieved.

Server Requirements

The Sessions sample (.NET) server is required.

Getting Started

Build and launch the Sessions sample server. Build and launch the sample. Enter a valid target URL of the sample server into the text box. Perform the login procedure: enter any text into the Username text field and the same text into the Password text field, then click the Login button. You can also try to enter different values into those text fields; you'll see, that login will fail.
Enter any text for the session variable name into the Name text field and any text for the variable value into the Value field. Click the Set Value button to store the value. Erase the entered value into the Value field and click the Get Value button. The variable value will be retrieved from the server.

Examine the code

The ROSessionsClient class is responsible for the sample operations. Examine -(IBAction)performLogin:(id)sender

//Set the clientChannel to the correct URL for our server
[clientChannel setTargetUrl:[edtServerURL stringValue]];
        
//Call the loginService
loggedIn = [loginService Login:[edtUsername stringValue] :[edtPassword stringValue]];
        
if (loggedIn)
{
    NSLog(@"logged in");
    // ...          
    mySessionID = [[sessionService GetSessionID] uppercaseString];
    // ...
}
else
{
    NSLog(@"login failed");
    // ...
}

and -(IBAction)performLogout:(id)sender

[loginService Logout:myClientID];
loggedIn = NO;
mySessionID = @"";

methods to see how the login service is called to let the user log in and log out. Examine -(IBAction)performSetSessionValue:(id)sender and -(IBAction)performSetSessionValue:(id)sender to see how variable values are stored and retrieved back.