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

My own developed - Active Directory Cache Inspector for AD Driver Novell Identity manager

Sometimes there is a need for us (Consultants) to see a snapshot of all the changes that happened on the Active directory side while the Novell AD IDM driver was stopped or was not running, before we decide to start the AD driver. Since Novell Identity Manager currently allows us to see all the events which happened in the Identity vault only, but not on the AD side, I decided to write such a tool myself, and of course wanted to share this tool with the consultants/community out there. It's a .NET 2.0 WinForm application, written in C# programming language. To run this tool you should have at minimum: .NET 2.0 framework installed, ( Not supported on the Linux platforms yet) This application must be run under the same user which is configured on the AD driver. Short Tutorial (How To): When you run the application (ADCView.exe), the application automatically discovers the current domain, a domain controller, and default domain naming context in the user logged in domain automatically

NetIQ IDM - How to read Component type data from Query nodeset done from command transformation

Suppose query: <do-set-local-variable name="local.sub.ctp.QueryContacts" scope="policy"> <arg-node-set> <token-query class-name="User" scope="entry"> <arg-match-attr name="UPN"> <arg-value type="string"> <token-src-attr class-name="User" name="UPN"/> </arg-value> </arg-match-attr> <arg-match-attr name="contacts"> <arg-value type="string"> <token-text xml:space="preserve">get-contacts</token-text> </arg-value> </arg-match-attr> <arg-match-attr name="userid"> <arg-value type="string"> <token-association/> </arg-value> </arg-match-attr> </token-query> </arg-node-set> </do-set-local-variable> Outpu