Skip to main content

NetIQ IDM - SOAP driver -- Handling SOAP service response and manufacturing user association without XSLT



Always pain working with SOAP service and its handling of service response on Query(matching) for user to work with matching policies?


Here is the quick wins; without reading those long lengthy & boring useless SOAP driver blog series at netIQ forums;


1. Make sure you have mapped User class in the schema map with some service attributes

2. Make sure Input and Output policy is registered with all the namespaces you have in your request/response soap messages, example <policy xmlns:soap="http://www.w3.org/2003/05/soap-envelope"

3. I have added operation-data (which is being generated from the Output policy) as part of the SOAP query, but you can skip it if you do not need this. src-dn and association are important to indicate engine for building association.  Operation data will help you to identify operation type and you can carry actions according to it.



Inject this on Output ( To support user matching) to send service request:

<rule> <description>[service] Convert Query to SOAP doc</description> <conditions> <and> <if-operation mode="case" op="equal">query</if-operation> </and> </conditions> <actions> <do-set-local-variable name="local.sub.etp.QueryDN" scope="policy"> <arg-node-set> <token-query class-name="User" datastore="src"> <arg-dn> <token-text xml:space="preserve">MGMT\World</token-text> </arg-dn> <arg-match-attr name="Custom-UPN"> <arg-value type="string"> <token-op-attr name="userName" /> </arg-value> </arg-match-attr> </token-query> </arg-node-set> </do-set-local-variable> <do-if> <arg-conditions> <and> <if-xpath op="true">count($local.sub.etp.QueryDN) =1</if-xpath> </and> </arg-conditions> <arg-actions> <do-set-local-variable name="local.sub.etp.DN" scope="policy"> <arg-string> <token-xpath expression="$local.sub.etp.QueryDN/@src-dn" /> </arg-string> </do-set-local-variable> </arg-actions> <arg-actions /> </do-if> <do-append-xml-element expression=".." name="soap:Envelope" /> <do-append-xml-element expression="../soap:Envelope" name="soap:Header" /> <do-append-xml-element expression="../soap:Envelope" name="soap:Body" /> <do-append-xml-element expression="../soap:Envelope/soap:Body" name="cad:GetUser" /> <do-append-xml-element expression="../soap:Envelope/soap:Body/cad:GetUser" name="cad:_UID" /> <do-append-xml-text expression="../soap:Envelope/soap:Body/cad:GetUser/cad:_UID"> <arg-string> <token-local-variable name="SessionID" /> </arg-string> </do-append-xml-text> <do-append-xml-element expression="../soap:Envelope/soap:Body/cad:GetUser" name="cad:upn" /> <do-append-xml-text expression="../soap:Envelope/soap:Body/cad:GetUser/cad:upn"> <arg-string> <token-op-attr name="userName" /> </arg-string> </do-append-xml-text> <do-append-xml-element expression=".." name="operation-data" /> <do-set-xml-attr expression="../operation-data" name="command"> <arg-string> <token-text>query</token-text> </arg-string> </do-set-xml-attr> <do-set-xml-attr expression="../operation-data" name="ref-src-dn"> <arg-string> <token-local-variable name="local.sub.etp.DN" /> </arg-string> </do-set-xml-attr> <do-strip-xpath expression="self::query" /> </actions> </rule>


Inject this on Publisher input to handle the service response;

<policy xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <rule> <description>[service] Handle GetUserResponse documents</description> <conditions> <and> <if-xpath op="true">self::soap:Envelope/soap:Body</if-xpath> <if-xpath op="true">//operation-data[@command="query"]</if-xpath> </and> </conditions> <actions> <do-set-local-variable name="Id" scope="policy"> <arg-string> <token-xpath expression="*//*[local-name()='ID']/text()" /> </arg-string> </do-set-local-variable> <!-- fix asso --> <do-if> <arg-conditions> <and> <if-local-variable mode="regex" name="Id" op="not-equal">.+</if-local-variable> </and> </arg-conditions> <arg-actions> <do-trace-message> <arg-string> <token-text xml:space="preserve">User not found!!</token-text> </arg-string> </do-trace-message> <do-break /> </arg-actions> <arg-actions /> </do-if> <do-append-xml-element expression=".." name="instance" /> <do-set-xml-attr expression="../instance" name="class-name"> <arg-string> <token-text xml:space="preserve">User</token-text> </arg-string> </do-set-xml-attr> <!-- fix fake dn --> <do-set-xml-attr expression="../instance" name="src-dn"> <arg-string> <token-xpath expression="//operation-data[@command=&quot;query&quot;]/@ref-src-dn" /> </arg-string> </do-set-xml-attr> <!-- fix association --> <do-append-xml-element expression=".." name="association" /> <do-append-xml-element expression="../instance" name="association" /> <do-set-xml-attr expression="../instance/association" name="state"> <arg-string> <token-text>associated</token-text> </arg-string> </do-set-xml-attr> <do-append-xml-text expression="../instance/association"> <arg-string> <token-xpath expression="*//*[local-name()='ID']/text()" /> </arg-string> </do-append-xml-text> <!-- add attributes --> <do-append-xml-element expression="../instance" name="attr" /> <do-set-xml-attr expression="../instance/attr[last()]" name="attr-name"> <arg-string> <token-text xml:space="preserve">Id</token-text> </arg-string> </do-set-xml-attr> <do-append-xml-element expression="../instance/attr[@attr-name='Id']" name="value" /> <do-append-xml-text expression="../instance[@class-name=&quot;User&quot;]/attr[@attr-name=&quot;Id&quot;]/value"> <arg-string> <token-xpath expression="*//*[local-name()='ID']/text()" /> </arg-string> </do-append-xml-text> <do-set-local-variable name="Id" scope="policy"> <arg-string> <token-xpath expression="*//*[local-name()='ID']/text()" /> </arg-string> </do-set-local-variable> <do-set-local-variable name="source-dn" scope="policy"> <arg-string> <token-xpath expression="//operation-data[@command=&quot;query&quot;]/@src-dn" /> </arg-string> </do-set-local-variable> <do-trace-message> <arg-string> <token-text xml:space="preserve">Unique ID VALUE =&gt; </token-text> <token-local-variable name="Id" /> </arg-string> </do-trace-message> <do-strip-xpath expression="self::soap:Envelope" /> <do-break /> </actions> </rule> </policy>

Comments

Geoffrey Carman said…
As the author of those long and boring articles on the SOAP drivers, I resemble that comment!

This is a nice approach, different than mine, and both serve purposes. The more the merrier.

Popular posts from this blog

Experience writing a Java based DirXML Driver

Based on the customer project, I wrote a DirXML driver which provision users through Novell Identity Manager 3.5.1 to their company intranet portal ( A Plone System). The portal exposed the RESTful API interfaces. So I started looking first at the Novell SOAP driver to see if it fit our needs. But while reading the driver documentation i felt it required too much XSLT knowledge + more customization and testing on the driver. And again it used the Apache HttpClient, Which is more a HttpClient rather then it targets to any specific protocol implementation. So If you could build SOAP messages at your own so it would help you in transporting these message back and forth between IDM and Application. The Novell SOAP driver comes up with two built in configurations "SPML and DSML", but in my case none of them were suitable. I had always wished to write my own DirXML driver at my own, so I thought why not just take this opportunity to fulfill my wish and at the same time get s...

NetIQ IDM - JDBC statemens using policy builder

Few examples of using JDBC statements using dirxml policies On the Output policy: Handling matching policies with operation-data support: < rule > < description > [DB] Convert Query to DDL doc </ description > < comment name = "author" xml:space = "preserve" > Maqsood Ali Bhatti </ comment > < comment name = "version" xml:space = "preserve" > 5 </ comment > < comment name = "lastchanged" xml:space = "preserve" > Dec 20, 2017 </ comment > < conditions > < and > < if-operation mode = "case" op = "equal" > query </ if-operation > </ and > </ conditions > < actions > < do-append-xml-element expression = ".." name = "jdbc:statement" /> < do-append-xml-element expression = "../jdbc:statement[las...

Novell IdM 3.6 : Creating custom Subscriber PostProcessor Java extension for Delimited Text Driver Part 1

I had chance to write a custom PostProcessor extension for a Delimited Text Driver for Novell Identity Manager,  " t he PostProcessor extension should execute the code under another Windows Domain User account. So I decided to run the driver with Remote Loader Configuration, running the DirXML windows Service under another Windows Domain User Account. " Software and settings in my setup: * Novell Designer 3.0.1 (build  Jan 5, 2009) * Novell Identity Manager 3.6 / Windows Server 2003 R2 * Novell iManager 2.7.2 * Delimited Text Driver 3.6 ver 2.0 (imported configuration  file from Designer 3.0.1) * And the Delimited Text Driver was going to run on the remote server (Remote Loader),  * Java IDE was  (IntelliJIDEA) i started first with digging into documentation of the driver, and i came a cross this section: Using Java Interfaces to Customize File Processing: http://www.novell.com/documentation/idm36drivers/delimited/index.html?page=/documentation/idm36drivers/delimited/data/bkt...