How to invoke OIM from custom web application

One might want to use Oracle Identity Manager in their IDM projects for sure. Just in case if you wanted to access OIM functions at runtime in a custom web application, this post will help you.

When you are writing custom connectors in OIM, you will create a java class that has your own methods plus OIM invoking functionality. In that case, you will need to use the below code for setting OIM environment variables.

Hashtable<String, String> env=new Hashtable<String, String>();

env.put(“XL.HomeDir”, “/u01/apps/OIMPwdReset”);
env.put(“java.security.policy”,”/u01/apps/OIMPwdReset/config/xl.policy”);
env.put(“java.security.auth.login.config”,”/u01/apps/OIMPwdReset/config/auth.conf”);

You will need to package this class file into jar file and point it in OIM connector while configuring. At runtime, this class file will establish OIM connection using the OIM environment parameters XL.HomeDir, java.security.policy, java.security.auth.login.config.

However, when you have a custom web application that is residing outside the OIM server and when you want to establish OIM connectivity, the above methodology does not work. To elaborate, we have OIM server residing in OHS server (7777)  and there is a custom web application in different web server (80), then how do I invoke the OIM? If you use the above methodology, you will get an exception while creating tcUtilityFactory instance.

Here is the sample code:

System.setProperty(“XL.HomeDir”, “/u01/apps/OIMPwdReset”);
System.setProperty(“java.security.policy”, “/u01/apps/OIMPwdReset/config/xl.policy”);
System.setProperty(“java.security.auth.login.config”, “/u01/apps/OIMPwdReset/config/auth.conf”);

The OIM API Usage guide tells us to use hashtable for setting environment variables, but does not suggest to use System.setProperty. Anyhow, hope this code snippet helps people.

About the Author Mahendra

I am engulfed in Oracle Identity & Access Management domain. I have expertise on providing the optimized solutions for user provisioning, web access management, Single Sign-On and federation capabilities etc., I am also well versed with complex integrations within Identity Management and other product domains. I have expertise on building demos and implementation experience on products Oracle Access Manager, Oracle Adaptive Access Manager, Oracle Entitlement Server, Oracle Virtual Directory, Oracle Internet Directory etc., Look @ my blog: http://talkidentity.blogspot.com

Leave a Comment:

4 comments
Andre Almar says March 3, 2011

Hi Atul,

Have you ever faced this error before?

oracle.iam.platform.utils.OIMAppInitializationException:
OIM application intialization failed because of the following reasons:
oim-config.xml was not found in MDS Repository.
Unable to find keystore “default-keystore.jks” in /config/fmwconfig/.
Unable to find keystore “.xldatabasekey” in /config/fmwconfig/.
Password for OIMSchemaPassword is not seeded in CSF.
Password for xell is not seeded in CSF.
Password for DataBaseKey is not seeded in CSF.
Password for JMSKey is not seeded in CSF.
Password for .xldatabasekey is not seeded in CSF.
Password for default-keystore.jks is not seeded in CSF.
Password for SOAAdminPassword is not seeded in CSF.

Regards

Reply
Mahendra says March 3, 2011

Andre,

Is it related to OIM 11g? I have not worked on OIM 11g yet. However from the error it seems that you are missing some keysore files in fmwconfig folder.

-Mahendra.

Reply
Atul Kumar says March 3, 2011

@ Andre Almar,
Yes I had this issue couple of times in past.

Run OIM config step again as mentioned here

http://onlineappsdba.com/index.php/2010/08/23/part-vi-configure-identity-manager-oim-oracleidm-11g-step-by-step-installation-of-oam-oim-oaam-oapm-oin/

After OIM configuration , restart admin server and then start OIM managed server

Reply
Kumar says May 18, 2011

Hi Atul,

Is it possible to install the SOA 11g and OIM 11g in seperate machines(box) and integrate them??
I have a sevre already SOA11g installed and I need to integrate that with OIM 11g. Is it possbile. If so can you please suggest with some links.

Thanks is adavance.

Regards,

Kumar

Reply
Add Your Reply

Not found