Import XML Object From Rule

Which IIQ version are you inquiring about?

8.3p3

Share all details related to your problem, including any error messages you may have received.

Hi all!
I need to import XML objects from a folder that is in /opt/sailpoint/…/ and I need to achieve this using a rule. Is there a way to do this?
These XML objects are identities, and the idea would be running a task that will be using this rule, and this rule will be picking up these XML objects, importing and creating them in the environment.

Thanks in advance!

Hi @ninfante_solidigm,

You can use IIQ console to import all the xml objects in one time.

using something like below source file with list of all identities using IIQ console command

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE sailpoint PUBLIC 'sailpoint.dtd' 'sailpoint.dtd'>
<sailpoint>
  <ImportAction name='include' value='/opt/sailpoint/…/idn1.xml'/>
  <ImportAction name='include' value='/opt/sailpoint/…/idn2.xml'/>
  <ImportAction name='include' value='/opt/sailpoint/…/idn3.xml'/>
</sailpoint>

Thanks

Thanks for the reply!
Let me see if we have access to the IIQ console.
Apart from that option, do you have any other suggestions? Especially because the servers are Linux, and .bat files won’t be executable.

Thanks in advance.

Hi @ninfante_solidigm,

Please try out below code snippet. By using it you will be able to import object. You may also try save object option.

XMLReferenceResolver xml=new SimpleXMLReferenceResolver();
  Object obj=SailPointObject.parseXml(xml,FileUtils.readFileToString(new File("File Path"),Charset.defaultCharset()));

  context.importObject((SailPointObject) obj);

Let me know in case of any query or issue.

Thanks

Hi @ashutosh08, thanks for commenting!
I’m following your instructions as below:

sailpoint.tools.xml.XMLReferenceResolver xml = new SimpleXMLReferenceResolver();
Object obj = SailPointObject.parseXml(xml,FileUtils.readFileToString(new File("opt/sailpoint/..."),Charset.defaultCharset()));
context.importObject((SailPointObject) obj);
context.saveObject(obj);
context.commitTransaction();

It doesn’t throw any errors if I use context.saveObject but looks like it doesn’t create the identity.
If I use commitTransaction, it throws the following error:

"Exception running rule: The application script threw an exception: sailpoint.tools.GeneralException: org.hibernate.TransientObjectException: object references an usaved transient instance - save the transient instance before flushing: sailpoint.object.identity BSF info: Run Rule at line: 0 column: columnNo"

If I’m doing something wrong, if I’m missing anything please let me know!

Thanks in advance

You can use importXml from Importer

String xml = <read file into string.....>
Importer i = new Importer(context);
 i.importXml(xml);
context.commitTransaction();
2 Likes

Hi @vishal_kejriwal1 , it worked!
Thank you so much, and the rest that helped me as well!

Much appreciate it

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.