TEWS Example - Get Worklist For A User and Approve or Reject a Workitem
search cancel

TEWS Example - Get Worklist For A User and Approve or Reject a Workitem

book

Article ID: 252309

calendar_today

Updated On:

Products

CA Identity Suite CA Identity Manager

Issue/Introduction

TEWS Example showing how to get the worklist for a specific user and also how to approve reject a workitem by the workitem ID

Environment

All Identity Manager

Resolution

You could use a soap call like this to get the worklist of a user where the output would show the <Id> value which is the workitem ID:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://tews6/wsdl">
   <soapenv:Header/>
   <soapenv:Body>
      <wsdl:TaskContext>
         <wsdl:admin_id>MY_LOGIN_USER</wsdl:admin_id>
         <wsdl:admin_password>MY_PASSWORD</wsdl:admin_password>  
      </wsdl:TaskContext>
      <wsdl:ViewUserWorkListQuery>
         <wsdl:ViewUserWorkListSearch>
            <wsdl:Subject index="?">
   <wsdl:Name>TEST_USER</wsdl:Name>
   </wsdl:Subject>
   </wsdl:ViewUserWorkListSearch>
      </wsdl:ViewUserWorkListQuery>
   </soapenv:Body>
</soapenv:Envelope>

You would then take that workitem Id and use it where you see the "X Y ZZZ:WPDS" value in the below approve and reject soap calls:

In order to approve/reject a request via TEWS the soap call would look something like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://tews6/wsdl">
   <soapenv:Header/>
   <soapenv:Body>
      <wsdl:TaskContext>
         <wsdl:admin_id>MY_LOGIN_USER</wsdl:admin_id>
         <wsdl:admin_password>MY_PASSWORD</wsdl:admin_password>
         <wsdl:workitem_id>X Y ZZZ:WPDS</wsdl:workitem_id>
         <wsdl:action>approve</wsdl:action>
      </wsdl:TaskContext>
      <wsdl:ApproveModifyUser>
      </wsdl:ApproveModifyUser>
   </soapenv:Body>
</soapenv:Envelope>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://tews6/wsdl">
   <soapenv:Header/>
   <soapenv:Body>
      <wsdl:TaskContext>
         <wsdl:admin_id>MY_LOGIN_USER</wsdl:admin_id>
         <wsdl:admin_password>MY_PASSWORD</wsdl:admin_password>
         <wsdl:workitem_id>X Y ZZZ:WPDS</wsdl:workitem_id>
         <wsdl:action>reject</wsdl:action>
      </wsdl:TaskContext>
      <wsdl:ApproveModifyUser>
      </wsdl:ApproveModifyUser>
   </soapenv:Body>
</soapenv:Envelope>