// Request the login service from the service client factory.
LoginRemote loginService = dfaServices.get(session, LoginRemote.class);
// Authenticate.
UserProfile userProfile = loginService.authenticate(username, password);
// Display user profile token, DFA account name and ID.
System.out.printf("User profile token is \"%s\", DFA account name is \"%s\", and DFA " +
"account ID is \"%s\".%n", userProfile.getToken(), userProfile.getNetworkName(),
userProfile.getNetworkId());