Users Sessions: LogoutEnds your web service session

See Also

Usage Notes

Session Cookie

SOAP works over standard HTTP/HTTPS protocol, and as such is a stateless connection. That means that each connection has a request and response, and is initiated by your client, and terminated by the server. In order for the server to maintain a reference to a client a session cookie is returned in the headers of the response. The cookie name is ASP.NET_SessionId, and its value is a random 24 character alpha-numeric string. The following examples are written in C#, however the same principles apply to all languages.

Retrieving the Cookie after initial Login
  1. Establish a connection to the server
  2. Invoke the Login method
  3. Retrieve the cookie value from the response headers
// create an instance of the SOAP service var service = new com.fleetfreedom.soap.FleetFreedomCoreServices(); service.UserAgent = "ApplicationName;AppVersion;RegionCode;"; service.Timeout = 10000; // milliseconds service.CookieContainer = new System.Net.CookieContainer(); // establish a session service.Login("username","password","address","ApplicationName","AppVersion;RegionCode"); // <Login Success="1" Message="Welcome" UserID="#" /> // retrieve your cookie var url = new System.Uri(service.Url); var cookies = service.CookieContainer.GetCookies(url); console.log(cookies["ASP.NET_SessionId"].Value); // == here it is!
Using the Cookie for all subsequent SOAP methods
  1. Establish a connection to the server
  2. Add the cookie to your request headers
  3. Invoke the IsLoggedIn (or any other) method
// create an instance of the SOAP service var service = new com.fleetfreedom.soap.FleetFreedomCoreServices(); service.UserAgent = "ApplicationName;AppVersion;RegionCode;"; service.Timeout = 10000; // milliseconds // create a cookie container and a cookie var url = new System.Uri(service.Url); var jar = new System.Net.CookieContainer(); var cookie = new System.Net.Cookie("ASP.NET_SessionId", COOKIE_GOES_HERE, "/", url.Host); jar.Add(cookie); // use the cookie container with the service service.CookieContainer = jar; // your client session is maintained service.IsLoggedIn(); // <IsLoggedIn Success="1" Message="This session is still valid for the next N minutes." />

Example of Returned Data

<Logout Success="1" Message="Logged Out" />

Test Method