I am trying to create a new user in a custom LDAP repository (Ex: RepositoryID =custpmRepo) using IBM Virtual Member Manager API (Java code). Trying to use the IBM code for creating users. But this is creating user in default repository (defaultWIMFileBasedRealm- InternalFileRepository).
IBM Docs referred https://www.ibm.com/support/knowledgecenter/SSAW57_8.0.0/com.ibm.websphere.wim.doc/programmingprereq.html https://www.ibm.com/support/knowledgecenter/SSAW57_8.0.0/com.ibm.websphere.wim.doc/samplecodeforworkingwithusersandgroups.html
Could anyone please guide me on how to create user in custom LDAP repository using VMM API (Java code). Below is the code which I am using to create user
public static void addPersonAccount(String uid, String cn, String sn)
{
System.out.println("****#### UserAndGroupSample - addPersonAccount - Entering Method");
try
{
locateService(EJB_JNDI_NAME);
DataObject root = SDOHelper.createRootDataObject();
DataObject entity = SDOHelper.createEntityDataObject(root, null,
SchemaConstants.DO_PERSON_ACCOUNT);
entity.set("uid", uid);
entity.set("cn", cn);
System.out.println("Input data graph before creating user"+ printDO(root));
// Create the PersonAccount entity
root = service.create(root);
System.out.println("Output data graph after creating user"+ printDO(root));
}
catch(Exception e)
{
System.out.println("Exception: " + e.getMessage());
e.printStackTrace();
}
System.out.println("****#### UserAndGroupSample - addPersonAccount - Exiting Method");
}
One can set the below properties to create user in the desired Custom LDAP Repository (on-default parent or under a different OrgContainer) by setting the parent user.createDataObject(DO_PARENT).createDataObject(DO_IDENTIFIER).setString(PROP_UNIQUE_NAME, parentDN) where parentDN is the uniqueName of the parent, like, o=LDAP or ou=sample,o=defaultWIMFileBasedRealm