
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Failing to send xml in the REST driver
Hi,
I'm trying to set up a REST-driver that will send its data as xml instead of JSON and I can't get it to work. Does anyone have an example of how a proper document should look like? The only example in the documentation uses JSON.
My attempt so far looks like this. Replacing the content of the value node with some JSON text and changing the content type to application/json works fine.
<nds dtdversion="4.0" ndsversion="8.x">
<source>
<product edition="Advanced" version="4.7.1.1">DirXML</product>
<contact>NetIQ Corporation</contact>
</source>
<input>
<add cached-time="20201216105057.775Z" class-name="User" event-id="IAMIDM01#20201216105057#2#1:a1639d42-0733-409e-b221-429d63a13307" qualified-src-dn="O=IDM\OU=Users\CN=User1" src-dn="\IDM-TREE\IDM\Users\User1" src-entry-id="1130087" timestamp="0#0">
<association state="manual"></association>
<add-attr attr-name="firstName">
<value timestamp="1509383032#384" type="string">Test</value>
</add-attr>
<add-attr attr-name="email">
<value timestamp="1509383032#395" type="string">**PERSONAL INFORMATION REMOVED**</value>
</add-attr>
<add-attr attr-name="costCenter">
<value type="string">aaaa00</value>
</add-attr>
<add-attr attr-name="lastName">
<value timestamp="1509383032#386" type="string">Person</value>
</add-attr>
<add-attr attr-name="employeeNumber">
<value timestamp="1509383032#397" type="string">User01</value>
</add-attr>
<add-attr attr-name="departmentName">
<value timestamp="1509616894#70" type="string">IT</value>
</add-attr>
<add-attr attr-name="departmentCode">
<value timestamp="1509616894#74" type="string">Department</value>
</add-attr>
</add>
<driver-operation-data class-name="User" command="add">
<request>
<url-token/>
<header content-type="application/xml"/>
<value>
<userRecords>
<userRecord>
<id>prnn01</id>
<userAttribute>
<name>firstName</name>
<value>Test</value>
</userAttribute>
<userAttribute>
<name>email</name>
<value>**PERSONAL INFORMATION REMOVED**</value>
</userAttribute>
<userAttribute>
<name>costCenter</name>
<value>aaaa00</value>
</userAttribute>
<userAttribute>
<name>lastName</name>
<value>Person</value>
</userAttribute>
<userAttribute>
<name>employeeNumber</name>
<value>User01</value>
</userAttribute>
<userAttribute>
<name>departmentName</name>
<value>IT</value>
</userAttribute>
<userAttribute>
<name>departmentCode</name>
<value>Department</value>
</userAttribute>
</userRecord>
</userRecords>
</value>
</request>
</driver-operation-data>
</input>
</nds>
[12/16/20 11:52:18.625]:REST Driver ST:REST Driver: sub-execute
[12/16/20 11:52:18.625]:REST Driver ST:REST Driver: addHandler
[12/16/20 11:52:18.626]:REST Driver ST:REST Driver: addHandler: class-name == 'User'
[12/16/20 11:52:18.626]:REST Driver ST:REST Driver: Add: preparing POST to https://ourwebservice.com/webservice/
[12/16/20 11:52:18.626]:REST Driver ST:SubscriptionShim.execute() returned:
[12/16/20 11:52:18.626]:REST Driver ST:
<nds dtdversion="3.0">
<source>
<product build="20180206_0824" version="1.0.0.2">Identity Manager REST Driver</product>
<contact>NetIQ Corporation.</contact>
</source>
<output>
<status level="fatal" type="driver-status">
<description>java.lang.IllegalArgumentException: Source string may not be null</description>
<exception class-name="java.lang.IllegalArgumentException">
<message>Source string may not be null</message>
<stack-trace>java.lang.IllegalArgumentException: Source string may not be null
at org.apache.http.util.Args.notNull(Args.java:54)
at org.apache.http.entity.StringEntity.<init>(StringEntity.java:67)
at org.apache.http.entity.StringEntity.<init>(StringEntity.java:118)
at com.novell.nds.dirxml.driver.rest.HttpRESTAddOperation.sendHttpRequest(HttpRESTOperations.java:605)
at com.novell.nds.dirxml.driver.rest.RESTSubscriptionShim.handleDriverOperationNode(RESTSubscriptionShim.java:752)
at com.novell.nds.dirxml.driver.rest.RESTSubscriptionShim.handleCommandOperation(RESTSubscriptionShim.java:871)
at com.novell.nds.dirxml.driver.rest.RESTSubscriptionShim.addHandler(RESTSubscriptionShim.java:903)
at com.novell.nds.dirxml.driver.rest.RESTSubscriptionShim.dispatch(RESTSubscriptionShim.java:667)
at com.novell.nds.dirxml.driver.rest.RESTSubscriptionShim.execute(RESTSubscriptionShim.java:493)
at com.novell.nds.dirxml.engine.Subscriber.execute(Subscriber.java:473)
at com.novell.nds.dirxml.engine.Subscriber.execute(Subscriber.java:304)
at com.novell.nds.dirxml.engine.Subscriber$AddProcessor.process(Subscriber.java:1623)
at com.novell.nds.dirxml.engine.Subscriber$SyncProcessor.processUnassociatedSync(Subscriber.java:2041)
at com.novell.nds.dirxml.engine.Subscriber$SyncProcessor.process(Subscriber.java:1917)
at com.novell.nds.dirxml.engine.Subscriber.processEvent(Subscriber.java:1197)
at com.novell.nds.dirxml.engine.Subscriber.processEvents(Subscriber.java:1010)
at com.novell.nds.dirxml.engine.Driver.submitTransaction(Driver.java:901)
at com.novell.nds.dirxml.engine.DriverEntry.submitTransaction(DriverEntry.java:1174)
at com.novell.nds.dirxml.engine.DriverEntry.processCachedTransaction(DriverEntry.java:1058)
at com.novell.nds.dirxml.engine.DriverEntry.eventLoop(DriverEntry.java:866)
at com.novell.nds.dirxml.engine.DriverEntry.run(DriverEntry.java:640)
at java.lang.Thread.run(Thread.java:748)
</stack-trace>
</exception>
Thank you in advance!
Regards,
Philip Sundqvist

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
A bit of a shot in the dark... have you tried removing spaces and new lines from your value xml? Perhaps put quotes around it so it is treated as a string?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I'll have to ask: why don't you use the SOAP driver?
In the REST driver, you'd have to serialize your userRecords element into a text to put into the value element. But it's entirely possible that the REST shim expects a valid JSON object within the value element...
Norbert

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
The receiving application expects a REST request, so I don't think a SOAP driver would work. I agree that it seems like it expects a JSON object to be present in the value element.
I think I'll open an SR about this, according to the docs it should be possible.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Have you thought about using Stefaan's driver for text protocols: http://vancauwenberge.info/#txtp
With that one you should be able to do what you want, as I suspect that the Rest driver will not be able to talk XML.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Good idea. I was building the XML document using the append xml element token. But unfortunately sending it all as a text string made no difference, with or without quotes.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Did you text version look like this?
<nds dtdversion="4.0" ndsversion="8.x">
<source>
<product version="4.8.2.0">DirXML</product>
<contact>NetIQ Corporation</contact>
</source>
<input>
<add cached-time="20201216105057.775Z" class-name="User" event-id="IAMIDM01#20201216105057#2#1:a1639d42-0733-409e-b221-429d63a13307" qualified-src-dn="O=IDM\OU=Users\CN=User1" src-dn="\IDM-TREE\IDM\Users\User1" src-entry-id="1130087" timestamp="0#0">
<association state="manual"/>
<add-attr attr-name="firstName">
<value timestamp="1509383032#384" type="string">Test</value>
</add-attr>
<add-attr attr-name="email">
<value timestamp="1509383032#395" type="string">**PERSONAL INFORMATION REMOVED**</value>
</add-attr>
<add-attr attr-name="costCenter">
<value type="string">aaaa00</value>
</add-attr>
<add-attr attr-name="lastName">
<value timestamp="1509383032#386" type="string">Person</value>
</add-attr>
<add-attr attr-name="employeeNumber">
<value timestamp="1509383032#397" type="string">User01</value>
</add-attr>
<add-attr attr-name="departmentName">
<value timestamp="1509616894#70" type="string">IT</value>
</add-attr>
<add-attr attr-name="departmentCode">
<value timestamp="1509616894#74" type="string">Department</value>
</add-attr>
</add>
<driver-operation-data class-name="User" command="add">
<request>
<url-token/>
<header content-type="application/xml"/>
<value><userRecords>
<userRecord>
<id>prnn01</id>
<userAttribute>
<name>firstName</name>
<value>Test</value>
</userAttribute>
<userAttribute>
<name>email</name>
<value>**PERSONAL INFORMATION REMOVED**</value>
</userAttribute>
<userAttribute>
<name>costCenter</name>
<value>aaaa00</value>
</userAttribute>
<userAttribute>
<name>lastName</name>
<value>Person</value>
</userAttribute>
<userAttribute>
<name>employeeNumber</name>
<value>User01</value>
</userAttribute>
<userAttribute>
<name>departmentName</name>
<value>IT</value>
</userAttribute>
<userAttribute>
<name>departmentCode</name>
<value>Department</value>
</userAttribute>
</userRecord>
</userRecords></value>
</request>
</driver-operation-data>
</input>
</nds>
Norbert


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content