Search This Blog

Tuesday 13 June 2017

Creating Connection using OIMClient in Local and Calling API to Perform Task

To Connect OIM from Local, we need below piece of code along with the list of jars which are as below: 

commons-logging.jar
spring.jar oimclient.jar
jrf-api.jar
wlfullclient.jar

Please navigate to /Oracle_IDM1/server/client in side zip file oimclient.zip, extract oimclient.zip. It will contain all the major jar files that we need to establish connection. Use the below code to create the connection. 

 public void OIMConnection(){ 
         //Function to Connection to OIM
        OIMClient oimClient = null; System.setProperty("java.security.auth.login.config",                    "D:/designconsole/config/authwl.conf"); 
        //Update path of authwl.conf(its can be found inside designconsole) file according to your environment System.setProperty("weblogic.Name", "wls_oim1"); 
        System.setProperty("APPSERVER_TYPE", "wls"); 
        HashTable env = new HashTable(); 
        env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");                         env.put(Context.PROVIDER_URL, "t3://localhost:14000"); //Update localhost with your OIM      machine IP 
try { 
           oimClient.login("xelsysadm", "Password".toCharArray()); //Update password of Admin with your                environment password 
           System.out.print("Successfully Connected with OIM "); 
       } 
catch (LoginException e) 

          System.out.print("Login Exception"+ e); 
 } 

// To use Platform API, use oimclient.getService(Service Name) instead of Platform.getService(Service Name)

 userManager = oimClient.getService(UserManager.class); } Now call the above method and use it to fetch detail from OIM running it locally.

No comments:

Post a Comment