Wednesday 31 August 2011

How to extend Payload from OIM to SOA in OIM11G

At times it is required to connect to OIM from SOA BPEL flow to get additional attributes. This requires using oimClient to log in into OIM from SOA Java activity and querying the OIM database using APIs or queries. This can lead to performance issue as login into OIM takes time and then there is issue of not being able to share objects between various activities between SOA activities. Thus there has to be multiple logins from each activity and proper coding standards to be followed of log out of OIM in each activity. As a workaround, the OOTB payload can be extended to send me more attributes from OIM to SOA during approval processing.
This extending requires creating of plugin class and plugin point xml and uploading the plugin into OIM. This plugin would intercept the payload before it is sent to SOA and would add the other required attributes to it.

Implement the RequestPayloadFieldGenerator interface and use the following way to add additional fields in the method populateAdditionalPayloadField
@Override
public void populateAdditionalPayloadFields(RequestData requestdata, Process payload) {
// Get the details form payload in which you want to modify data element.
// e.g.: If you want to  modify data elements in other details

OtherDetails otherDetails = payload.getOtherDetails();

// Get the data elements list
List<Detailtype> detailtypesList = otherDetails.getDataElement();

//set your detail type in existing list
Detailtype detailtype = new Detailtype();
detailtype.setName(“Custom Attribute1”);
detailtype.setValue(“Custom VALUE1”);
detailtypesList.add(detailtype);
payload.setOtherDetails(otherDetails);

// Now the payload will be updated with above data element in other details section.
}
}
Plugin point definition file:

<?xml version='1.0' encoding='UTF-8'?>
<oimplugins xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oracle.com/schema/oim/plugin plugin.xsd">
<plugins pluginpoint="oracle.iam.request.plugins.RequestPayloadFieldGenerator">
<plugin pluginclass="com.oim.iam.payload.PayloadAdder " version="1.1" name=" PayloadAdder ">
<metadata name="DefaultPlugin">
<value>true</value>
</metadata>
</plugin>
</plugins>
</oimplugins>

No comments:

Post a Comment