Wednesday, September 26, 2012

WebServices and OIM11G


I’ll show today two examples using WebServices and integrate these with OIM11G, step by step:
 
First example it will check user/password against OIM11G and if match return true:
1-Java Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
public ActionResult logon(String loginID, String password) {
    System.out.println("Login ID: " + loginID);
    System.out.println("New Password: " + password);
 
    System.out.println("Session ID: " + getSessionID());
    ActionResult actionResult = new ActionResult();
    actionResult.setSuccess(true);
    actionResult.setResultMessage("Successfully login");
    actionResult.setResultCode(0);
 
    SessionToken sessionToken = new SessionToken();
    sessionToken.setLoginID(loginID);
    sessionToken.setLastUsedTimestamp(System.currentTimeMillis());
    sessionToken.setPassword(password);
    sessionToken.setSessionID(getSessionID());
 
    // Login to OIM code here
    Hashtable env = new Hashtable();
 
    env.put(OIMClient.JAVA_NAMING_FACTORY_INITIAL, "weblogic.jndi.WLInitialContextFactory");
    env.put(OIMClient.JAVA_NAMING_PROVIDER_URL, "http://ThiagoOIM11GServer:14000");
    oimClient = new OIMClient(env);
 
    try {
        oimClient.login(loginID, password.toCharArray());
    } catch (LoginException e) {
        e.printStackTrace();
    }
    setStringSessionAttribute(WSConstants.SESSION_LOGIN_ID_ATTRIBUTE_NAME,
                              loginID);
 
    actionResult.setSessionToken(sessionToken);
 
    return actionResult;
}
2-Don’t Forget WebServices terminology into your class:
3-Deploy your code into WebLogic and go to testing(into your war details):
4-When you click on this link above. It will open your WebService test page below:
Red Arrow(above) is showing all ‘button methods’  that you have into your java class.
5-Le’ts test ‘Logon method’ :
6-I added(above) one user and password that already exist into my OIM environment and then it should return me ‘true’ as showed below:
As you could see. It is connecting to OIM env thru WebService and returning if the user is valid or not.
Second example will check user account status sending user_key and Resource name as you can see below:
0-Code(JNDI call) required for this above :
1
2
3
4
5
6
7
8
9
10
11
  ...
     Hashtable env = new Hashtable(5);
     env.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
     env.put(Context.PROVIDER_URL,"t3://ThiagoServer:7001");
     ctx = new InitialContext(env);
      
     oimClient = new OIMClient(env);
     javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("myDS");
     // myDS ==> Java JNDI(Datasource Name into WebLogic)
     con = ds.getConnection();
...
1-Going to WebService test client:
2-And finally the expected result:
As you could see. It’s easy to ‘call’ OIM using webservices classes. I also did one video to make sure you will be happy with this help.
Video: http://youtu.be/1ncjF9hBrOc
I hope this helps. See you into next IDM article.
Thiago Leoncio.

Wednesday, August 8, 2012

OIM 11g: How to remove | uninstall connector


Follow the steps to remove OIM connector installed into your environment:
Step 1: Update ConnectorUninstall.properties according to your environment, connector and Objects that you want to remove:
Step 2-run {OIM_HOME/server/bin}uninstallConnector.sh script.
[oracle@thiagoserver bin]$ ./uninstallConnector.sh
*********************************************************************
* This utility deletes data from the OIM database directly and is *
* meant to be used in development/staging environments. *
* *
* WARNING: DO NOT USE IN PRODUCTION. *
*********************************************************************
Step 3-Run DeleteJars :
[command prompt will show:]
…
elem.type = “JavaTasks”;
elem.type = “ScheduleTask”;
elem.type = “ThirdParty”;
elem.type = “ICFBundle”;
…
DeleteJars script:
[oracle@thiagoserver bin]$ ./DeleteJars.sh
[command prompt]
[Enter Xellerate admin username :]xelsysadm
[Enter the admin password :]
[Enter serverURL :[ t3://localhost:7001 ]]t3://localhost:80
[Enter context Factory :[ weblogic.jndi.WLInitialContextFactory ]]
Enter the jar type
1.JavaTasks
2.ScheduleTask
3.ThirdParty
4.ICFBundle
Enter the name of jar to be deleted from DB :
OIDProv.jar or OIDRecon.jar(for this example: OID connector)
org.identityconnectors.siebel-1.0.1.jar(for example: Siebel connector)
Do u want to delete more jars [y/n] :y
Step 4- Run DeleteResourceBundles.sh and deleting all resources that are associated with the connector from Oracle Identity Manager database.
Check the successfully logs and run PurgeCache.sh utility as ./PurgeCache.sh ALL.
Done.
More details: http://docs.oracle.com/cd/E21764_01/doc.1111/e14308/conn_mgmt.htm
I hope this helps,
Thiago Leoncio