If you have been trying to import connector xml files and were unsuccessful with IE 7.x, that is due to the fact java policy now explicitly needs a File Read Permission. Here are the steps to make it work:
Windows ->Start -> Run -> policytool
File Open -> {Your JRE Location}/lib/security/java.policy
Select CodeBase
Hit Edit Policy Entry
Add Permission
From the Permission dropdown - select FilePermission
From the Target dropdown - select
From the Actions dropdown - select read
Hit ok, Done and File Save.
This should resolve your issue.
Wednesday, August 15, 2007
Oracle Identity Manager XML Import failure with IE 7.x
Posted by Rajnish Bhatia at 11:01 AM 0 comments
Monday, August 6, 2007
Calling OIM User Operations from a JSP Web Page
Environment : Tomcat 4.1 , JBoss 4.0.3 SP1, OIM 9.0.3.1
===================================
File: raj.jsp
===================================
<%@page import="com.oim.xl.integration.UserOperations" %>
<%@page import="java.util.*" %>
<html>
<title>OIM</title>
<body>
Finding user with first name System <BR>
<%
String s="";
UserOperations uo=new UserOperations();
List lst=uo.getUserLogin("System");
ListIterator it = lst.listIterator();
while (it.hasNext()) {
s = (String) it.next();
}
%>
The result is : <%=s %>
</body>
</html>
===================================
File: UserOperations.class
===================================
package com.oim.xl.integration;
import java.util.*;
import Thor.API.tcResultSet;
import Thor.API.tcUtilityFactory;
import com.thortech.xl.util.config.ConfigurationClient;
import Thor.API.Operations.tcOrganizationOperationsIntf;
import Thor.API.Operations.tcUserOperationsIntf;
public class UserOperations {
/** The utility factory instance. */
private tcUtilityFactory ioUtilityFactory;
public UserOperations(){
Hashtable env=new Hashtable();
env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
env.put("java.naming.provider.url", "jnp://192.168.1.101:1099");
System.setProperty("java.security.manager", "");
System.setProperty("XL.HomeDir", "C:\\tomcat4.1\\config");
System.setProperty("java.security.policy", "C:\\tomcat4.1\\config\\xl.policy");
System.setProperty("java.security.auth.login.config", "C:\\tomcat4.1\\config\\auth.conf");
System.setProperty("java.naming.provider.url", "jnp://192.168.1.101:1099/UserOperations");
Enumeration enum = env.keys();
while(enum.hasMoreElements())
{
String s = (String)enum.nextElement();
}
try{
log("Connect as : xelsysadm ");
ioUtilityFactory = new tcUtilityFactory(env, "xelsysadm","xelsysadm");
log("Connected as : " + ioUtilityFactory.getUserName());
}catch(Exception ex)
{
ex.printStackTrace();
}
}
/** Retrieves user login based on the first name. */
public List getUserLogin(String psFirstName){
Vector mvUsers=new Vector();
try{
tcUserOperationsIntf moUserUtility =(tcUserOperationsIntf)ioUtilityFactory.getUtility("Thor.API.Operations.tcUserOperationsIntf");
log("Interface tcUserOperationsIntf moUserUtility successfully created.");
Hashtable mhSearchCriteria = new Hashtable();
mhSearchCriteria.put("Users.First Name", psFirstName);
tcResultSet moResultSet = moUserUtility.findUsers(mhSearchCriteria);
log("Finding Users with First Name "+ psFirstName);
for (int i=0; i<moResultSet.getRowCount(); i++){
moResultSet.goToRow(i);
mvUsers.add(moResultSet.getStringValue("Users.User ID"));
log("Key is : "+ String.valueOf(moResultSet.getLongValue("Users.Key")) + " for user id : "+ moResultSet.getStringValue("Users.User ID"));
}
} catch(Exception ex){ex.printStackTrace();}
return mvUsers;
}
private void log(String msg){
System.out.println(msg);
}
public String setEmailID(String userLogin, String emailid){
String rtnval="SUCCESS";
try
{
log("Changing Email Id for user : "+userLogin+" to "+emailid);
tcUserOperationsIntf moUserUtility =(tcUserOperationsIntf)ioUtilityFactory.getUtility("Thor.API.Operations.tcUserOperationsIntf");
Hashtable mhSearchCriteria = new Hashtable();
mhSearchCriteria.put("Users.User ID", userLogin);
tcResultSet moResultSet = moUserUtility.findUsers(mhSearchCriteria);
for (int i=0; i<moResultSet.getRowCount(); i++){
moResultSet.goToRow(i);
log("Key is : "+ String.valueOf(moResultSet.getLongValue("Users.Key")) + " for user id : "+ moResultSet.getStringValue("Users.User ID") + " with old email id: "+ moResultSet.getStringValue("Users.Email"));
}
HashMap hm = new HashMap();
hm.put("Users.Email",emailid);
moUserUtility.updateUser(moResultSet, hm);
log("Email Id Changed Successfully to "+emailid);
}
catch(Exception e)
{
log("Change User Email Id Failed... Exception...." + e.getMessage());
rtnval="Error "+e.getMessage();
}
return rtnval;
}
/** Retrieves the administrators of an organization based on the organization name. */
public List getAdministratorsOfOrganization(String psOrganizationName){
Vector mvOrganizations=new Vector();
try{
tcOrganizationOperationsIntf moOrganizationUtility =(tcOrganizationOperationsIntf)ioUtilityFactory.getUtility("Thor.API.Operations.tcOrganizationOperationsIntf");
Hashtable mhSearchCriteria = new Hashtable();
mhSearchCriteria.put("Organizations.Organization Name", psOrganizationName);
tcResultSet moResultSet =moOrganizationUtility.findOrganizations(mhSearchCriteria);
tcResultSet moAdmins;
for (int i=0; i<moResultSet.getRowCount(); i++){
moResultSet.goToRow(i);
moAdmins=moOrganizationUtility.getAdministrators(moResultSet.getLongValue("Organizations.Key"));
mvOrganizations.add(moAdmins.getStringValue("Groups.Group Name"));
}
}
catch(Exception ex) { ex.printStackTrace();}
return mvOrganizations;
}
/**
* @param args
*
public static void main(String[] args) {
List moList;
UserOperations uo=new UserOperations();
moList=uo.getUserLogin("System");
uo.setEmailID("teste43", "rajnishbhatia19@hotmail.com");
System.exit(0);
}*/
}
================================
Results
================================
See attached OIM.jpg :
Posted by Rajnish Bhatia at 5:34 PM 2 comments
Wednesday, August 1, 2007
JUNIT Test Case for getting values from Oblix
============================
File: IDXMLUnitTest.java
============================
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import junit.framework.TestCase;
public class IDXMLUnitTest extends TestCase {
public IDXMLUnitTest(String name) {
super(name);
}
/* (non-Javadoc)
* @see junit.framework.TestCase#setUp()
*/
protected void setUp() throws Exception {
super.setUp();
}
/* (non-Javadoc)
* @see junit.framework.TestCase#tearDown()
*/
protected void tearDown() throws Exception {
super.tearDown();
}
public void testSearch()
{
String url = "http://localhost:8081/identity/oblix/apps/userservcenter/bin/userservcenter.cgi?wsdl";
System.out.println(url);
String authen = "
String xml = "
"
"
System.out.println("\n\n"+xml+"\n\n");
try
{
URL u = new URL(url);
System.out.println(" url .... " + url);
URLConnection c = u.openConnection();
HttpURLConnection conn = (HttpURLConnection) c;
conn.setRequestProperty("Content-Type", "text/xml");
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setRequestMethod("POST");
OutputStream out = conn.getOutputStream();
OutputStreamWriter wout = new OutputStreamWriter(out, "UTF-8");
wout.write(xml);
wout.flush();
out.close();
if(conn.getResponseCode() == 200) {
InputStream in = conn.getInputStream();
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = builderFactory.newDocumentBuilder();
Document document = builder.parse(new InputSource(in));
Element rootElement = document.getDocumentElement();
NodeList parentNode = rootElement.getElementsByTagName("ObValue");
Node node = parentNode.item(0);
System.out.println(" ...value ... " +node.getNodeName() + " .... " + node.getFirstChild().getNodeValue());
in.close();
}else
{
System.out.println(" conn.getResponseCode()" + conn.getResponseCode()) ;
}
conn.disconnect();
}catch(Exception e)
{
System.out.println("Exception ......." + e.getMessage());
}
}
}
==================
Result
==================
rajnishbhatia19@hotmail.com
courtesy:Dilip Nimse
Posted by Rajnish Bhatia at 3:10 PM 0 comments