belaie Absent Member.
Absent Member.
657 views

How to parse JSON payloads in Dirxml script ?


NetIQ Identity manager 4.0.2 AE

I'm trying to integrate to a REST webservice from Identity manager using
a custom Http driver, since i do feel the default netiq SOAP driver is
quite complex and outdated to work with. but anyhow, I have now
established the connection between IDM and REST webservice and can
invoke http methods easily and can get back the replies. but the
replies from the webservice is based on JSON payloads. and I'm not sure
how to parse these JSON payloads easily using dirxml!!. they way i do
for SOAP based payloads using ParseXML stuff. which is quite kinda cool,
you get to work with nodesets and nodes in good way using dirxml
toolset.

Is there any thing that I can do to parse these JSON payloads using
netiq identity manager engine ( do no ask me to use Userapp).

I really do not want to read them as strings and find for the keys and
values manually feel like stupid doing this back in 80s.


I hope someone has the answer here 🙂

Regards,
M.


--
belaie
------------------------------------------------------------------------
belaie's Profile: https://forums.netiq.com/member.php?userid=308
View this thread: https://forums.netiq.com/showthread.php?t=53309

Labels (1)
0 Likes
12 Replies
Knowledge Partner
Knowledge Partner

Re: How to parse JSON payloads in Dirxml script ?

belaie wrote:

> Is there any thing that I can do to parse these JSON payloads using
> netiq identity manager engine ( do no ask me to use Userapp).


I'm not aware of any direct JSON support in IDM but Ecmascript/Xpath/Java are
an option. Lots of java JSON libraries out there e.g. minimal-json that you can
call from XPath, either directly or via ECMA...
______________________________________________
https://www.is4it.de/identity-access-management
0 Likes
Knowledge Partner
Knowledge Partner

Re: How to parse JSON payloads in Dirxml script ?

Lothar Haeger wrote:

> Lots of java JSON libraries out there...


Converting JSON to XML and then use XPath as usual would be another option,
e.g. using
http://www.json.org/javadoc/org/json/XML.html#toString%28java.lang.Object%29
______________________________________________
https://www.is4it.de/identity-access-management
0 Likes
Knowledge Partner
Knowledge Partner

Re: How to parse JSON payloads in Dirxml script ?

"Lothar Haeger" <lothar.haeger@is4it.de> wrote:
> Lothar Haeger wrote:
>
>> Lots of java JSON libraries out there...

>
> Converting JSON to XML and then use XPath as usual would be another option,
> e.g. using
> http://www.json.org/javadoc/org/json/XML.html#toString%28java.lang.Object%29


Just to be clear, having worked with JSON and converting to XML that some
endpoints expose JSON that can't be legitimately converted to XML. Things
like JSON key (element name) beginning with a non-alpha character like $
and also JSON value/data that can only be expressed as CDATA.

Also some endpoints return just a plain string (not your typical JSON key -
value pair) or even a Boolean true/false. These are valid JSON but many
JSON to XML libraries only can handle the more common JSON structures.

So if you go down the JSON to XML path try and find a very robust JSON to
XML parser.

--
If you find this post helpful and are logged into the web interface, show
your appreciation and click on the star below...
Alex McHugh - Knowledge Partner - Stavanger, Norway
Who are the Knowledge Partners
If you appreciate my comments, please click the Like button.
If I have resolved your issue, please click the Accept as Solution button.
0 Likes
belaie Absent Member.
Absent Member.

Re: How to parse JSON payloads in Dirxml script ?


Okay.. i'm really confused now. what should I do.. is in't there any out
of the box netiq libraries that are shipped with product to work with
JSON payloads??..
i'm sure i am not the only one who is working with REST webservices from
NetIQ identity manager. there must be a solution.

we want to poll a REST webservice and create some IDM objects based on
the result of that webservice. so if I do plain javascript find/text
approach i will end up with a messy code!


--
belaie
------------------------------------------------------------------------
belaie's Profile: https://forums.netiq.com/member.php?userid=308
View this thread: https://forums.netiq.com/showthread.php?t=53309

0 Likes
Knowledge Partner
Knowledge Partner

Re: How to parse JSON payloads in Dirxml script ?

belaie wrote:

> Okay.. i'm really confused now. what should I do.. is in't there any out
> of the box netiq libraries that are shipped with product to work with
> JSON payloads??..
> i'm sure i am not the only one who is working with REST webservices from
> NetIQ identity manager. there must be a solution.
>
> we want to poll a REST webservice and create some IDM objects based on
> the result of that webservice. so if I do plain javascript find/text
> approach i will end up with a messy code!


Two options (at least):

1) use a java library to convert your JSON to XML in an input transform (any
probably back to JSON in an output transform), then continue with XML in the
remaining driver policies

2) use a java library to work with JSON directly in all driver policies

In both cases you will have to

- find a suitable library
- copy the library jar(s) to /opt/nopvel/eDirectoty/lib/dirxml/classes
- restart ndsd
- (optional but stringly recommended): write ECMAscript function wrappers for
the calls to the java library
- call your functions from XPath

Good Luck!

Lothar
______________________________________________
https://www.is4it.de/identity-access-management
0 Likes
Knowledge Partner
Knowledge Partner

Re: How to parse JSON payloads in Dirxml script ?

belaie wrote:

> is in't there any out
> of the box netiq libraries that are shipped with product to work with
> JSON payloads??..


Not that I am aware of. you may check the libs loaded by the engine if there's
any JSON stuff included you can call from XPath/ECMA. There are definitely no
DirXMLScript tokens to deal with JSON.

> i'm sure i am not the only one who is working with REST webservices from
> NetIQ identity manager. there must be a solution.


Apart from the above outlined, if you have some more time to wait with this
implementation, NetIQ is working on a REST based shim that was announced at
Brainshare last fall and should be out "soon". Maybe you can get a more precise
due date from your sales rep....
______________________________________________
https://www.is4it.de/identity-access-management
0 Likes
abergvall1 Absent Member.
Absent Member.

Re: How to parse JSON payloads in Dirxml script ?


lhaeger;256336 Wrote:
> belaie wrote:
>
> > is in't there any out
> > of the box netiq libraries that are shipped with product to work with
> > JSON payloads??..

>
> Not that I am aware of. you may check the libs loaded by the engine if
> there's
> any JSON stuff included you can call from XPath/ECMA. There are
> definitely no
> DirXMLScript tokens to deal with JSON.
>
> > i'm sure i am not the only one who is working with REST webservices

> from
> > NetIQ identity manager. there must be a solution.

>
> Apart from the above outlined, if you have some more time to wait with
> this
> implementation, NetIQ is working on a REST based shim that was announced
> at
> Brainshare last fall and should be out "soon". Maybe you can get a more
> precise
> due date from your sales rep....


Hello,

Got word that the REST driver is supposed to be ready in June. So
probably September 😉

br
/Anders


--
abergvall
------------------------------------------------------------------------
abergvall's Profile: https://forums.netiq.com/member.php?userid=278
View this thread: https://forums.netiq.com/showthread.php?t=53309

0 Likes
Knowledge Partner
Knowledge Partner

Re: How to parse JSON payloads in Dirxml script ?

On 4/12/2015 5:29 PM, Lothar Haeger wrote:
> Lothar Haeger wrote:
>
>> Lots of java JSON libraries out there...

>
> Converting JSON to XML and then use XPath as usual would be another option,
> e.g. using
> http://www.json.org/javadoc/org/json/XML.html#toString%28java.lang.Object%29


On a side note. I looked at a couple of JSON Java libraries, and they
basically were doing string manipulations, which kind of pissed me off.
I thought that JS has some magic to handle JSON. But it was just
doing stupid string stuff.

0 Likes
Knowledge Partner
Knowledge Partner

Re: How to parse JSON payloads in Dirxml script ?

On Sun, 12 Apr 2015 20:41:48 +0000, belaie wrote:

> NetIQ Identity manager 4.0.2 AE
>
> I'm trying to integrate to a REST webservice from Identity manager using
> a custom Http driver, since i do feel the default netiq SOAP driver is
> quite complex and outdated to work with.


Your best bet is to talk to Geoffrey. He's worked this out with a byte
array modifier hooked in to the SOAP driver to do the bidirectional JSON/
XML conversion you need.


--
--------------------------------------------------------------------------
David Gersic dgersic_@_niu.edu
Knowledge Partner http://forums.novell.com

Please post questions in the forums. No support provided via email.
If you find this post helpful, please click on the star below.
0 Likes
Knowledge Partner
Knowledge Partner

Re: How to parse JSON payloads in Dirxml script ?

On 4/13/2015 11:30 AM, David Gersic wrote:
> On Sun, 12 Apr 2015 20:41:48 +0000, belaie wrote:
>
>> NetIQ Identity manager 4.0.2 AE
>>
>> I'm trying to integrate to a REST webservice from Identity manager using
>> a custom Http driver, since i do feel the default netiq SOAP driver is
>> quite complex and outdated to work with.

>
> Your best bet is to talk to Geoffrey. He's worked this out with a byte
> array modifier hooked in to the SOAP driver to do the bidirectional JSON/
> XML conversion you need.


And I used a Java class I found that did the conversion from JSON to
XML. Which is then manageable in Policy and XSLT.


0 Likes
Knowledge Partner
Knowledge Partner

Re: How to parse JSON payloads in Dirxml script ?

Geoffrey Carman <geoffreycarmanNOSPAM@NOSPAMgmail.com> wrote:

> And I used a Java class I found that did the conversion from JSON to XML.
> Which is then manageable in Policy and XSLT.


I've also tweaked this Java class from Geoffrey to handle problematic JSON
/ XML conversion scenarios as I described yesterday. However the original
poster said they did not want to use the SOAP driver for this.

My advice to original poster.

If you can't wait for REST driver from netiq, then use SOAP + Geoffrey's
byteArrayModifier Java class. Works fine.

I don't know if any public netiq Java classes which can do the JSON to xml
roundtrip conversion, so you need to rely on a third party class or write
your own.

--
If you find this post helpful and are logged into the web interface, show
your appreciation and click on the star below...
Alex McHugh - Knowledge Partner - Stavanger, Norway
Who are the Knowledge Partners
If you appreciate my comments, please click the Like button.
If I have resolved your issue, please click the Accept as Solution button.
0 Likes
Knowledge Partner
Knowledge Partner

Re: How to parse JSON payloads in Dirxml script ?

On 4/13/2015 5:05 PM, Alex McHugh wrote:
> Geoffrey Carman <geoffreycarmanNOSPAM@NOSPAMgmail.com> wrote:
>
>> And I used a Java class I found that did the conversion from JSON to XML.
>> Which is then manageable in Policy and XSLT.

>
> I've also tweaked this Java class from Geoffrey to handle problematic JSON
> / XML conversion scenarios as I described yesterday. However the original
> poster said they did not want to use the SOAP driver for this.


That reminds me, you need to send me back the source for your changes. 🙂

> My advice to original poster.
>
> If you can't wait for REST driver from netiq, then use SOAP + Geoffrey's
> byteArrayModifier Java class. Works fine.
>
> I don't know if any public netiq Java classes which can do the JSON to xml
> roundtrip conversion, so you need to rely on a third party class or write
> your own.
>


0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.