CA Identity Manager - Web Services Examples for Searching and Cancelling Scheduled Tasks and Resubmit Task
search cancel

CA Identity Manager - Web Services Examples for Searching and Cancelling Scheduled Tasks and Resubmit Task

book

Article ID: 111476

calendar_today

Updated On:

Products

CA Identity Manager CA Identity Suite

Issue/Introduction

TEWS examples for searching Scheduled tasks, Cancelling a task, and Resubmitted a task.

 

Environment

Identity Manager

Identity Suite

Resolution

First be sure you have enabled Web Services for the "View Submitted Tasks".


1) Example TEWS request to search for Scheduled tasks to get the TaskId:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://tews6/wsdl">
   <soapenv:Header/>
   <soapenv:Body>
      <wsdl:TaskContext>
       <wsdl:admin_id>MyUser</wsdl:admin_id>
       <wsdl:admin_password>MyPassword</wsdl:admin_password>
      </wsdl:TaskContext>
      <wsdl:ViewSubmittedTasksQuery>
         <wsdl:ViewSubmittedTasksSubmittedTasksTab>
            <wsdl:SearchCriteria>
               <wsdl:Status>Scheduled</wsdl:Status>
            </wsdl:SearchCriteria>
         </wsdl:ViewSubmittedTasksSubmittedTasksTab>
      </wsdl:ViewSubmittedTasksQuery>
   </soapenv:Body>
</soapenv:Envelope>

Response will give list of Task which are in progress.

You can use multiple search criteria based on your requirements

2) Example TEWS request to cancel a task based on the TaskID:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://tews6/wsdl">
   <soapenv:Header/>
   <soapenv:Body>
      <wsdl:TaskContext>
       <wsdl:admin_id>MyUser</wsdl:admin_id>
       <wsdl:admin_password>MyPassword</wsdl:admin_password>
      </wsdl:TaskContext>
      <wsdl:ViewSubmittedTasksQuery>
         <wsdl:ViewSubmittedTasksSubmittedTasksTab>           
            <wsdl:TaskDetails>             
               <wsdl:TaskId>xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxx</wsdl:TaskId>
               <wsdl:CancelTask>True</wsdl:CancelTask>
            </wsdl:TaskDetails>
         </wsdl:ViewSubmittedTasksSubmittedTasksTab>
      </wsdl:ViewSubmittedTasksQuery>
   </soapenv:Body>
</soapenv:Envelope>


3) Example TEWS request to resubmit a cancelled task based on the TaskID (the resubmitted task will execute immediately):

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://tews6/wsdl">
   <soapenv:Header>
      <wsdl:ViewSubmittedTasksQueryTaskContext>
       <wsdl:admin_id>MyUser</wsdl:admin_id>
       <wsdl:admin_password>MyPassword</wsdl:admin_password>
      </wsdl:ViewSubmittedTasksQueryTaskContext>
   </soapenv:Header>
   <soapenv:Body>
      <wsdl:ViewSubmittedTasksQuery>
         <wsdl:ViewSubmittedTasksSubmittedTasksTab>           
        <wsdl:TaskDetails>             
               <wsdl:TaskId>xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxx</wsdl:TaskId>
               <wsdl:ResubmitTask>True</wsdl:ResubmitTask>
            </wsdl:TaskDetails>
         </wsdl:ViewSubmittedTasksSubmittedTasksTab>
      </wsdl:ViewSubmittedTasksQuery>
   </soapenv:Body>
</soapenv:Envelope>