Terminating Active User Sessions

Declare Variables/Constants

String CONTACT_SERVER = "localhost";
int SERVER_PORT = 5093;

/*Modify following macros in reference to the client for which active session is to be killed.*/
String CLIENT_HOSTNAME = "client_hostName";
String CLIENT_USERNAME = "client_userName";

LmAdminAttribute attrLmAdminContext = null;
LmAdminContext adminContext = null;

String input = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<lmadmin>" + "<terminateLoginSession>" +
               "<hostName>" + CLIENT_HOSTNAME + "</hostName>\n" + "<userName>" + CLIENT_USERNAME + 
               "</userName>\n" + "<xDisplayName>" + CLIENT_XDISPLAYNAME + "</xDisplayName>" + 
               "<vendorDefinedSharingId>" + CLIENT_VENDORDEFINEDSHAREID + "</vendorDefinedSharingId>" + 
               "</terminateLoginSession>" + "</lmadmin>";

API Calls

To terminate active user session(s), execute the APIs in the specified sequential order only:

>attrLmAdminContext = new LmAdminAttribute();

>attrLmAdminContext.set(LmAdminConstants.SNTL_ATTR_LMADMINCONTEXT_NETWORK_TIMEOUT, "30");

>adminContext = new LmAdminContext(CONTACT_SERVER, SERVER_PORT, attrLmAdminContext);

>String status = adminContext.post(input);

If the adminContext.post call is successful, then status String contains an XML-based output having the detailed information about the action of post api.

NOTE   The client macro names in this XML (such as CLIENT_HOSTNAME) should be replaced with actual client identification names. The clientInfo API can be called to obtain the actual values for client macro names.