Friday, May 12, 2017

OIM: Create OIM connection from IDE(Eclipse/Jdev)

Given that you are able to create a project a your IDE, carry out the following two exercise to connect to OIM to execute your APIs:

  1. Writing the code
  2. Importing the necessary jars

Code:

import java.util.Hashtable;
import javax.security.auth.login.LoginException;
import oracle.iam.platform.OIMClient;


public class OimConnection {

    private static final String OIM_URL = "t3://iamsoaguru.local.com:14000";
    private static final String AUTH_CONF = "C://Rohit//designconsole//config//authwl.conf";
    protected static final String OIMUSERNAME = "xelsysadm";
    protected static final String OIMPASSWORD = "Welcome1";
    protected OIMClient oimClient = null;

    public OIMClient BaseClient() {

        System.setProperty("APPSERVER_TYPE", "wls");
        System.setProperty("java.security.auth.login.config", AUTH_CONF);
        Hashtable<String, String> env = new Hashtable<String, String>();
        env.put(OIMClient.JAVA_NAMING_FACTORY_INITIAL,
                "weblogic.jndi.WLInitialContextFactory");
        env.put(OIMClient.JAVA_NAMING_PROVIDER_URL, OIM_URL);
        oimClient = new OIMClient(env);

        try {
            oimClient.login(OIMUSERNAME, OIMPASSWORD.toCharArray());
            System.out.println("BaseClient.BaseClient() Login SUCCESS");
        } catch (LoginException e) {
            System.out.println("Exception in getting oimConnection");
            e.printStackTrace();
        }

        return oimClient;
    }

}

Required Jars:
  1. Commons-logging.jar
  2. Eclipselink.jar
  3. Jrf-api.jar
  4. OIMClient.jar
  5. Spring.jar
  6. WLFullClient.jar

1 comment: