This example takes a numeric value which has been converted to a string inside the templating system and then converts it into an integer value to perform preprocessing on the data before sending it to the SPML Service.
In this example, the imported CSV file contains only three pieces of data.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <batchRequest onError="urn:oasis:names:tc:SPML:1:0#resume" processing="urn:oasis:names:tc:SPML:1:0#sequential" execution="urn:oasis:names:tc:SPML:1:0#synchronous" xmlns="urn:oasis:names:tc:SPML:1:0"> #foreach ( $REC_ in $RECS_ ) #set ($userhandle = "User=${REC_.username},Domain=YOUR_USER_DOMAIN,Server=Server") ''' #set ($datetimeobject = $date.toDate('yyyyMMdd',${REC_.expirydate})) #set ($formatdate = $date.format('yyyy-MM-dd', $datetimeobject)) #set ($formattime = $date.format('H:m:s', $datetimeobject))''' <addRequest requestID="batchAdd${REC_.INDEX}"> <identifier type="urn:oasis:names:tc:SPML:1:0#DN"> <id>$userhandle</id> </identifier> <attributes> <attr name="accountId"> <ns1:value xmlns:ns1="urn:oasis:names:tc:DSML:2:0:core">${REC_.username}</ns1:value> </attr> <attr name="roleHandles"> <ns2:value xmlns:ns2="urn:oasis:names:tc:DSML:2:0:core">Role=ntRole,Domain=YOUR_USER_DOMAIN,Server=Server</ns2:value> </attr> <attr name="enableDate"> <ns3:value xmlns:ns3="urn:oasis:names:tc:DSML:2:0:core">'''${formatdate}T${formattime}'''</ns3:value> </attr> </attributes> </addRequest> '''#if($math.toInteger(${REC_.priority}) > 500)''' <extendedRequest xmlns="urn:oasis:names:tc:SPML:1:0"> <operationalAttributes/> <providerIdentifier providerIDType="urn:oasis:names:tc:SPML:1:0#URN"> <providerID/> </providerIdentifier> <operationIdentifier operationIDType="urn:oasis:names:tc:SPML:1:0#GenericString"> <operationID>User-SyncWithRolesAddAccounts</operationID> </operationIdentifier> <identifier type="urn:oasis:names:tc:SPML:1:0#DN"> <id>$userhandle</id> </identifier> <attributes/> </extendedRequest> #end #end </batchRequest>
This request formats a proprietary data format into a format that the Provisioning Server can understand. The results of this request are:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <batchRequest onError="urn:oasis:names:tc:SPML:1:0#resume" processing="urn:oasis:names:tc:SPML:1:0#sequential" execution="urn:oasis:names:tc:SPML:1:0#synchronous" xmlns="urn:oasis:names:tc:SPML:1:0"> <addRequest requestID="batchAdd0"> <identifier type="urn:oasis:names:tc:SPML:1:0#DN"> <id>User=user3,Domain=YOUR_USER_DOMAIN,Server=Server</id> </identifier> <attributes> <attr name="accountId"> <ns1:value xmlns:ns1="urn:oasis:names:tc:DSML:2:0:core">user3</ns1:value> </attr> <attr name="roleHandles"> <ns2:value xmlns:ns2="urn:oasis:names:tc:DSML:2:0:core">Role=ntRole,Domain=YOUR_USER_DOMAIN,Server=Server</ns2:value> </attr> <attr name="enableDate"> <ns3:value xmlns:ns3="urn:oasis:names:tc:DSML:2:0:core">'''2010-10-01T0:0:0'''</ns3:value> </attr> </attributes> </addRequest> <extendedRequest> <operationalAttributes/> <providerIdentifier providerIDType="urn:oasis:names:tc:SPML:1:0#URN"> <providerID/> </providerIdentifier> <operationIdentifier operationIDType="urn:oasis:names:tc:SPML:1:0#GenericString"> <operationID>'''User-SyncWithRolesAddAccounts'''</operationID> </operationIdentifier> <identifier type="urn:oasis:names:tc:SPML:1:0#DN"> <id>'''User=user3,Domain=YOUR_USER_DOMAIN,Server=Server'''</id> </identifier> <attributes/> </extendedRequest> <addRequest requestID="batchAdd1"> <identifier type="urn:oasis:names:tc:SPML:1:0#DN"> <id>User=user4,Domain=YOUR_USER_DOMAIN,Server=Server</id> </identifier> <attributes> <attr name="accountId"> <ns4:value xmlns:ns4="urn:oasis:names:tc:DSML:2:0:core">user4</ns4:value> </attr> <attr name="roleHandles"> <ns5:value xmlns:ns5="urn:oasis:names:tc:DSML:2:0:core">Role=ntRole,Domain=YOUR_USER_DOMAIN,Server=Server</ns5:value> </attr> <attr name="enableDate"> <ns6:value xmlns:ns6="urn:oasis:names:tc:DSML:2:0:core">'''2010-10-05T0:0:0'''</ns6:value> </attr> </attributes> </addRequest> </batchRequest>
Copyright © 2011 CA. All rights reserved. | Email CA Technologies about this topic |