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

NetIQ IDM - Adding operation-data to subscriber command transformaiton custom commands

Recently i had to execute EOL cmdlets using psexecute though new NetIQ azure ad driver, since this operation is fire and forget in nature, i would like to track whole request and response for my own generated commands from subscriber command transofrmaiton policy, so i solved it by following policy: < do-set-dest-attr-value direct = "true" name = "psexecute" > < arg-association > < token-resolve datastore = "src" > < arg-dn > < token-text xml:space = "preserve" > {userref} </ token-text > </ arg-dn > </ token-resolve > </ arg-association > < arg-value type = "string" > < token-local-variable name = "cmdlet" /> </ arg-value > </ do-set-dest-attr-value > < do-append-xml-element expression = "../modify[@direct]" na...

Digging IDMUnit - IdMUnit a must-have automated testing tool that integrates with Designer for Novell Identity Manager

Good news, The IDMUnit 2.0 is out ( http://www.idmunit.org/web/guest/idmunit20 )!.. and I just couldn't wait to try the tool and do some hands on with it. Now it comes with a documentaiton and a WebMinar which helps a lot to understand how it works and how it integerates with the Novell Designer. The Webminar is encoded with the "G2M3" encoding, so you need a decoder in order to see both video and audio. I downloaded it from the web : https://www2.gotomeeting.com/codec I started with installing the tool on my PC Windows Vista 32bit OS. I have the following setup: Novell Designer Version: 3.5, Build id: 20090916 Novell Identity Manager 3.6.1 Windows Server 2003 SP3 Novell eDirectory 8.8.x The first thing the IDMUnit documentation says to apply so called "Eclipse Overlay", i downloaded " Eclipse IDE for Java Developers (92 MB) " that from the URL " http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo...