Previous Topic: Sealing and Activating a JobNext Topic: Conclusions


Closing the Session

When your client application has completed its work, it should log out of the DSM web service and close the session cleanly by using the Logout function.

Example 12: Logging out of the DSM Web Service

if(!sessionId.equals(""))
{
	int result = 0;
	if (null != wsAPIservice && null != wsAPIconnector)
	{
		try	
		{	
			result = wsAPIconnector.Logout(sessionId).intValue();
		}
		catch (Exception e)
		{
			throw e;
		}
	}
	if (result == 0)
	{
		sessionId = "";
		System.out.println( "Logout successful");
		return RESULT_OK;
	}
	else
	{
		//The session Id given could not be closed
		sessionId = "";
		return LOG_OUT_FAILURE;
	}
}
else
{
	//The user was not logged in
	return LOG_OUT_FAILURE;
}