Modifying a SOA Project in JDeveloper Disabling a SOA Composite on Oracle Identity Manager

Using Oracle Identity Manager APIs in SOA Composites 26-3

26.2.3 Updating the SOA Composite

To edit the SOA composite in JDeveloper:

1. In the left pane, click the Projects tab.

2. Select the ApprovalProcess.bpel file under the DefaultRequestApproval project

and open it. This displays the approval workflow.

3. In the right pane, in the Component Palette, select the Java Embedding task, and

drag and drop it after the receiveInput task in the workflow, before the ApprovalTask_1 human task. This creates a new task called Java_Embedding_1. Optionally, you can rename it to Invoke_OIM_API.

4. Double-click the Invoke_OIM_API Java task. This opens an editor in which you

can add the required Java code. Add the Java code as shown in Example 26–1 : Example 26–1 Embedded Java Source Code try { System.out.printlnPrototype for invoking an OIM API from a SOA Composite; System.out.printlnRTM Usecase: Organization Administrator; String oimUserName = ; String oimPassword = ; String oimURL = ; String roleApprover = ; String actKey = ; get oimuser credentials oracle.security.jps.JpsContext ctx = oracle.security.jps.JpsContextFactory.getContextFactory.getContext; final oracle.security.jps.service.credstore.CredentialStore cs = oracle.security.jps.service.credstore.CredentialStore ctx.getServiceInstanceoracle.security.jps.service.credstore.CredentialStore.class ; oracle.security.jps.service.credstore.CredentialMap cmap = cs.getCredentialMaporacle.oim.sysadminMap ; oracle.security.jps.service.credstore.Credential cred = cmap.getCredentialsysadmin; if cred instanceof oracle.security.jps.service.credstore.PasswordCredential { oracle.security.jps.service.credstore.PasswordCredential pcred = oracle.security.jps.service.credstore.PasswordCredentialcred; char[] p = pcred.getPassword; oimUserName = pcred.getName; oimPassword = new Stringp; } get oimurl Object obj = getVariableDataoimurl; oimURL = obj.toString; set the initial context factory String oimInitialContextFactory = weblogic.jndi.WLInitialContextFactory; 26-4 Oracle Fusion Middleware Developers Guide for Oracle Identity Manager set up the environment for making the OIM API invocation java.util.Hashtable env = new java.util.Hashtable; env.putoracle.iam.platform.OIMClient.JAVA_NAMING_FACTORY_INITIAL, oimInitialContextFactory; env.putoracle.iam.platform.OIMClient.JAVA_NAMING_PROVIDER_URL, oimURL; oracle.iam.platform.OIMClient client = new oracle.iam.platform.OIMClientenv; client.loginoimUserName, oimPassword.toCharArray; System.out.printlnLogin Successful; get Service oracle.iam.request.api.RequestService reqSvc = client.getServiceoracle.iam.request.api.RequestService.class; oracle.iam.identity.rolemgmt.api.RoleManager roleSvc = client.getServiceoracle.iam.identity.rolemgmt.api.RoleManager.class; oracle.iam.identity.usermgmt.api.UserManager usersvc = client.getServiceoracle.iam.identity.usermgmt.api.UserManager.class; Object reqIdXMLElem = getVariableDatainputVariable, payload, ns3:processns4:RequestID; String reqId = oracle.xml.parser.v2.XMLElementreqIdXMLElem.getText; System.out.printlnThe request ID is +reqId; invoke the getBasicRequestData method on the RequestService API oracle.iam.request.vo.Request req = reqSvc.getBasicRequestDatareqId; java.util.Listoracle.iam.request.vo.Beneficiary beneficiaries = req.getBeneficiaries; ifbeneficiaries = null{ fororacle.iam.request.vo.Beneficiary benf: beneficiaries{ get org key java.util.HashSetString searchAttrs = new java.util.HashSetString; searchAttrs.addoracle.iam.identity.usermgmt.api.UserManagerConstants. AttributeName.USER_LOGIN.getId; searchAttrs.addoracle.iam.identity.usermgmt.api.UserManagerConstants. AttributeName.USER_ORGANIZATION.getId; oracle.iam.identity.usermgmt.vo.User user1 = usersvc.getDetailsbenf.getBeneficiaryKey,searchAttrs, false; actKey = user1.getAttributeact_key.toString; get org admin ifactKey = actKey = { Thor.API.Operations.tcOrganizationOperationsIntf orgAPI = Thor.API.Operations.tcOrganizationOperationsIntfclient.getService Thor.API.Operations.tcOrganizationOperationsIntf.class;