Network and Security Manager 2010.4 API Guide
Logout
96
System.setProperty("javax.net.ssl.trustStore", trustStorePath);
System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
String log4jProperties = (String) properties.get("log4j.configuration");
String serverUrl = (String) properties.get("server.url");
Properties props = new Properties();
props.load(new FileInputStream(webDir + File.separator + log4jProperties));
PropertyConfigurator.configure(props);
PolicyAssignmentTest.stub = new DataCentricServiceStub(serverUrl +
"/axis2/services/DataCentricService");
PolicyAssignmentTest.jobServiceStub = new JobServiceStub(serverUrl +
"/axis2/services/JobService");
/**
*
Login to the system
*/
SystemServiceStub systemServiceStub = new SystemServiceStub(serverUrl +
"/axis2/services/SystemService");
LoginRequest loginRequest = new LoginRequest();
loginRequest.setUserName("super");
loginRequest.setDomainName("global");
loginRequest.setPassword("netscreen");
LoginResponseType loginResponse =
systemServiceStub.LoginRequest(loginRequest).getLoginResponse();
if ((LoginStatusCodeType.Success).equals(loginResponse.getLoginStatus().
getStatus())) {
PolicyAssignmentTest.authToken = loginResponse.getAuthToken();
}
PolicyAssignmentTest.setUpDone = true;
}
This API sample code shows how to log out from the NSM server.
public void testLogout() {
try {
LogoutRequest logoutRequest = new LogoutRequest();
logoutRequest.setAuthToken(authToken);
System.out.println("\nAuthToken: " + authToken.getToken() + " logging out
...");
stub.LogoutRequest(logoutRequest);
} catch (Exception e) {
e.printStackTrace();
}
}
Copyright © 2010, Juniper Networks, Inc.
Need help?
Do you have a question about the NETWORK AND SECURITY MANAGER 2010.4 - API GUIDE REV 1 and is the answer not in the manual?
Questions and answers