TEWS SOAP Sample: How to set alternate 'Create' action for 'Modify' action of non-existing users in ObjectsFeeder xml (bulk loader task)

Document ID : KB000017966
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

You need to import user data from a CSV file in a batch process using a TEWS XML soap request.
When the user exists a modify task must be performed with the correct attribute values.
When the user does not exist then an alternate create task must be performed with attribute values.

Solution:

In the following sample, See the Action2TaskMapAsString tag.
Modify action is performed for existing users else these are create actions.
FileContent is required, so you need to include your csv file.
FileName is dummy since the FileContent is populated.


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://tews6/wsdl">
   <soapenv:Header/>
    <soapenv:Body>
   <wsdl:TaskContext>
    <wsdl:admin_id>superadmin</wsdl:admin_id>
    <wsdl:admin_password>secret</wsdl:admin_password>
   </wsdl:TaskContext>
    <wsdl:ObjectsFeeder>
     <wsdl:ObjectsFeederRecordsDetailsTab>
      <wsdl:FileName>dummy.csv</wsdl:FileName>
        <wsdl:FileContent>   
action,uid,givenName,sn,cn,userPassword,mail,%ORG_MEMBERSHIP_NAME%,%ORG_MEMBERSHIP%,departmentNumber,l,postalAddress 
modify,JoeForester1,Joe,Forester,Joe Forester,Joe,Forester@mycom.com,USA,"ou=USA,ou=Dealer,ou=NeteAuto,dc=security,dc=com",QA,Boston,7 Glenn Ave
modify,JohnFred1,John,Fred,John Fred,John,Fred@mycom.com,USA,"ou=USA,ou=Dealer,ou=NeteAuto,dc=security,dc=com",QA,New York,420 9th Ave
modify,SamForest1,Sam,Forest,Sam Forest,Sam,Forest@mycom.com,USA,"ou=USA,ou=Dealer,ou=NeteAuto,dc=security,dc=com",QA,HL,123 Sokolov st
modify,JaneFadida1,Jane,Fadida,Jane Fadida,Jane,Fadida@mycom.com,USA,"ou=USA,ou=Dealer,ou=NeteAuto,dc=security,dc=com",QA,LA,14 Maple st.
modify,RitaFirst1,Rita,First,Rita First,Rita,First@mycom.com,USA,"ou=USA,ou=Dealer,ou=NeteAuto,dc=security,dc=com",QA,LA,88 Oak st.
      </wsdl:FileContent>
      <wsdl:ParserClass>com.ca.identitymanager.feeder.parser.CSVParser</wsdl:ParserClass>
      <wsdl:ParserDeletionSequence>NULL</wsdl:ParserDeletionSequence>
      <wsdl:ActionAttrName>action</wsdl:ActionAttrName>
      <wsdl:UniqueIdentifierAttrName>uid</wsdl:UniqueIdentifierAttrName>
    </wsdl:ObjectsFeederRecordsDetailsTab>
    <wsdl:ObjectsFeederFeederActionsMappingTab>
      <wsdl:PrimaryObject>USER</wsdl:PrimaryObject>
       <wsdl:Action2TaskMapAsString>modify.Modify User.Create User</wsdl:Action2TaskMapAsString>
      </wsdl:ObjectsFeederFeederActionsMappingTab>
    </wsdl:ObjectsFeeder>
  </soapenv:Body>
</soapenv:Envelope>