Hi,

I'm implementing a connection to IBM SmartCloud with the REST Driver and I have some troubles with the response of the webservice.

I made a successful request to the REST API of SmartCloud, but when I get the response with the JSON data, the input transformation policy CNETQRESTJSON-itp-JSONtoXDS doesn't translate the JSON data as I expected.

I enable some trace disabled portions of the policy trying to understand what exactly are the policy doing but no success.

This is the trace extract of the web service response:

Code:
[07/27/16 12:35:36.853]:REST Driver Trace ST:        DrvREST: Response code and message: 200 OK
[07/27/16 12:35:36.855]:REST Driver Trace ST:        SubscriptionShim.execute() returned:
[07/27/16 12:35:36.856]:REST Driver Trace ST:
<nds dtdversion="3.0">
  <source>
    <product build="20150722_0750" version="1.0.0.0">Identity Manager REST Driver</product>
    <contact>NetIQ Corporation.</contact>
  </source>
  <output>
    <status event-id="0" level="success" type="driver-general">
      <driver-operation-data class-name="Subscriber" command="query" dest-dn="" event-id="0">
        <response>
          <url-token mail="dlotus@hipra.com"/>
          <header content-type="application/json"/>
          <value>{"List":[{"Created":"07\/26\/2016 15:57:28","Modified":"07\/26\/2016 16:08:59","SubscriberState":"ACTIVE","Oid":200704483,"SubscriberAttributeSet":[{"StringValue":"  

.[SENSITIVE CONTENT].  

"SeatState":"ASSIGNED","EntitlementQuantityAllocated":0,"Owner":200677477,"WorkflowIdList":[],"Version":20,"SubscriptionId":
200069393,"OptimisticLock":0,"Deleted":false,"Id":201511711},{"VendorId":10,"SubscriberId":200704483,"TermsOfUseId":4,"SeatServiceProductAttributeSet":[],"ProvisioningWorkflowId":4515509,"C
reated":"07\/26\/2016 16:08:57","Modified":"07\/26\/2016 16:08:59","Oid":201511712,"HasAcceptedTermsOfUse":true,"SeatState":"ASSIGNED","EntitlementQuantityAllocated":0,"Owner":200677477,"Wo
rkflowIdList":[],"Version":17,"SubscriptionId":200069394,"OptimisticLock":0,"Deleted":false,"Id":201511712}]}]}</value>
        </response>
      </driver-operation-data>
    </status>
  </output>
</nds>
Now, the trace extract of the CNETQRESTJSON-itp-JSONtoXDS:

Code:
[07/27/16 12:35:36.897]:REST Driver Trace ST:        Applying policy: %+C%14CNETQRESTJSON-itp-JSONtoXDS%-C.
[07/27/16 12:35:36.897]:REST Driver Trace ST:          Applying to status #1.
[07/27/16 12:35:36.897]:REST Driver Trace ST:            Evaluating selection criteria for rule 'Translate JSON to XDS'.
[07/27/16 12:35:36.897]:REST Driver Trace ST:              (if-class-name available) = FALSE.
[07/27/16 12:35:36.898]:REST Driver Trace ST:              (if-operation match "status") = TRUE.
[07/27/16 12:35:36.898]:REST Driver Trace ST:            Rule selected.
[07/27/16 12:35:36.898]:REST Driver Trace ST:            Applying rule 'Translate JSON to XDS'.
[07/27/16 12:35:36.898]:REST Driver Trace ST:              Action: do-if().
[07/27/16 12:35:36.898]:REST Driver Trace ST:                Evaluating conditions.
[07/27/16 12:35:36.898]:REST Driver Trace ST:                  (if-operation match "status") = TRUE.
[07/27/16 12:35:36.898]:REST Driver Trace ST:                Performing if actions.
[07/27/16 12:35:36.898]:REST Driver Trace ST:                  Action: do-if().
[07/27/16 12:35:36.899]:REST Driver Trace ST:                    Evaluating conditions.
[07/27/16 12:35:36.899]:REST Driver Trace ST:                      (if-xpath true "string-length(./driver-operation-data/response/value/text())>0") = TRUE.
[07/27/16 12:35:36.899]:REST Driver Trace ST:                      (if-xpath true "./driver-operation-data[@command="query"]") = TRUE.
[07/27/16 12:35:36.899]:REST Driver Trace ST:                    Performing if actions.
[07/27/16 12:35:36.899]:REST Driver Trace ST:                      Action: do-set-local-variable("xmlInput",scope="policy",token-base64-encode(charset="UTF-8",token-replace-all("&lt;","<",t
oken-xml-serialize(token-xpath("./driver-operation-data/response/value/text()"))))).
[07/27/16 12:35:36.901]:REST Driver Trace ST:                        arg-string(token-base64-encode(charset="UTF-8",token-replace-all("&lt;","<",token-xml-serialize(token-xpath("./driver-op
eration-data/response/value/text()")))))
[07/27/16 12:35:36.902]:REST Driver Trace ST:                          token-base64-encode(charset="UTF-8",token-replace-all("&lt;","<",token-xml-serialize(token-xpath("./driver-operation-d
ata/response/value/text()"))))
[07/27/16 12:35:36.902]:REST Driver Trace ST:                            token-base64-encode(charset="UTF-8",token-replace-all("&lt;","<",token-xml-serialize(token-xpath("./driver-operation
-data/response/value/text()"))))
[07/27/16 12:35:36.903]:REST Driver Trace ST:                              token-replace-all("&lt;","<",token-xml-serialize(token-xpath("./driver-operation-data/response/value/text()")))
[07/27/16 12:35:36.903]:REST Driver Trace ST:                                token-replace-all("&lt;","<",token-xml-serialize(token-xpath("./driver-operation-data/response/value/text()")))
[07/27/16 12:35:36.903]:REST Driver Trace ST:                                  token-xml-serialize(token-xpath("./driver-operation-data/response/value/text()"))
[07/27/16 12:35:36.904]:REST Driver Trace ST:                                    token-xml-serialize(token-xpath("./driver-operation-data/response/value/text()"))
[07/27/16 12:35:36.904]:REST Driver Trace ST:                                      token-xpath("./driver-operation-data/response/value/text()")
[07/27/16 12:35:36.905]:REST Driver Trace ST:                                      Token Value: {"{&quot;List&quot;:[{&quot;Created&quot;:&quot..."}.
[07/27/16 12:35:36.906]:REST Driver Trace ST:                                      Arg Value: {"{&quot;List&quot;:[{&quot;Created&quot;:&quot..."}.
[07/27/16 12:35:36.907]:REST Driver Trace ST:                                    Token Value: "{"List":[{"Created":"07\/26\/2016 15:57:28","Modified":"07\/26\/2016 16:08:59","SubscriberStat
e":"ACTIVE","Oid":200704483,"SubscriberAttributeSet":[{"StringValue":"dlotus@hipra.com","SubscriberId":200704483,"Created":"07\/26\/2016 16:08:58","Modified":"07\/26\/2016 16:08:58","Boolea
nValue":false,"Oid":201381063,"Name":"dom__emailAddress","DisplayPrecedence":0.0,"Owner":200677477,"IntegerValue":0,"Version":8,"OptimisticLock":0,"Deleted":false,"Type":"STRING","Id":20138
1063}],"IsGuest":false,"InvitedBy":0,"IsSyncPending":false,"Owner":200677477,"Person":{"IsRestrictedUse":false,"Created":"07\/26\/2016 15:57:28","GivenName"

[SENSITIVE CONTENT]

"SeatState":"ASSIGNED","EntitlementQuantityAllocated":0,"Owner":200677477,"WorkflowIdList":[],"Version":20,"SubscriptionId":
200069393,"OptimisticLock":0,"Deleted":false,"Id":201511711},{"VendorId":10,"SubscriberId":200704483,"TermsOfUseId":4,"SeatServiceProductAttributeSet":[],"ProvisioningWorkflowId":4515509,"C
reated":"07\/26\/2016 16:08:57","Modified":"07\/26\/2016 16:08:59","Oid":201511712,"HasAcceptedTermsOfUse":true,"SeatState":"ASSIGNED","EntitlementQuantityAllocated":0,"Owner":200677477,"Wo
rkflowIdList":[],"Version":17,"SubscriptionId":200069394,"OptimisticLock":0,"Deleted":false,"Id":201511712}]}]}</value>
        </response>
      </driver-operation-data>
    </status>
  </output>
</nds>

[07/27/16 12:35:36.950]:REST Driver Trace ST:                          Arg Value:eyJMaXN0IjpbeyJDcmVhdGVkIjoiMDdcLzI2XC8yMDE2IDE1OjU3OjI4IiwiTW9kaWZpZWQiOiIwN1wvMjZcLzIwMTYgMTY6MDg6NTkiLC
JTdWJzY3JpYmVyU3RhdGUiOiJBQ1RJVkUiLCJPaWQiOjIwMDcwNDQ4MywiU3Vic2NyaWJlckF0dHJpYnV0ZVNldCI6W3siU3RyaW5nVmFsdWUiOiJkbG90dXNAaGlwcmEuY29tIiwiU3Vic2NyaWJlcklkIjoyMDA3MDQ0ODMsIkNyZWF0ZWQiOiIwN1w
vMjZcLzIwMTYgMTY6MDg6NTgiLCJNb2RpZmllZCI6IjA3XC8yNlwvMjAxNiAxNjowODo1OCIsIkJvb2xlYW5WYWx1ZSI6ZmFsc2UsIk9pZCI6MjA

[SENSITIVE CONTENT]

eyJMaXN0IjpbeyJDcmVhdGVkIjoiMDdcLzI2XC8yMDE2IDE1OjU3OjI4IiwiTW9kaWZpZWQiOiIwN1wvMjZcLzIwMTYgMTY6MDg6NTkiLC
JTdWJzY3JpYmVyU3RhdGUiOiJBQ1RJVkUiLCJPaWQiOjIwMDcwNDQ4MywiU3Vic2NyaWJlckF0dHJpYnV0ZVNldCI6W3siU3RyaW5nVmFsdWUiOiJkbG90dXNAaGlwcmEuY29tIiwiU3Vic2NyaWJlcklkIjoyMDA3MDQ0ODMsIkNyZWF0ZWQiOiIwN1w
vMjZcLzIwMTYgMTY6MDg6NTgiLCJNb2RpZmllZCI6IjAoyMDE1MTE3MTJ9XX1dfQ==".

[07/27/16 12:35:36.961]:REST Driver Trace ST:                      Action: do-set-local-variable("applicationContent",scope="policy",token-xpath("rs:jsonToXDS($xmlInput)")).
[07/27/16 12:35:36.961]:REST Driver Trace ST:                        arg-string(token-xpath("rs:jsonToXDS($xmlInput)"))
[07/27/16 12:35:36.961]:REST Driver Trace ST:                          token-xpath("rs:jsonToXDS($xmlInput)")
[07/27/16 12:35:36.966]:REST Driver Trace ST:                            Token Value: "".
[07/27/16 12:35:36.966]:REST Driver Trace ST:                          Arg Value: "".
[07/27/16 12:35:36.966]:REST Driver Trace ST:                      Action: do-if().
[07/27/16 12:35:36.966]:REST Driver Trace ST:                        Evaluating conditions.
[07/27/16 12:35:36.966]:REST Driver Trace ST:                          (if-local-variable 'applicationContent' not-equal "") = FALSE.
[07/27/16 12:35:36.967]:REST Driver Trace ST:                        Performing else actions.
[07/27/16 12:35:36.967]:REST Driver Trace ST:                      Action: do-strip-xpath("./driver-operation-data").
[07/27/16 12:35:36.967]:REST Driver Trace ST:        Policy returned:
[07/27/16 12:35:36.967]:REST Driver Trace ST:
<nds dtdversion="3.0">
  <source>
    <product build="20150722_0750" version="1.0.0.0">Identity Manager REST Driver</product>
    <contact>NetIQ Corporation.</contact>
  </source>
  <output>
    <status event-id="0" level="success" type="driver-general"/>
  </output>
</nds>
I tried passing only the content of the <value> element instead of the full XDS to the rs:jsonToXDS() function with no success.


Do anybody knows what is wrong?

Thanks in advance,
Rodrigo