0 Replies Latest reply on Oct 14, 2019 5:11 AM by Vsegu-Oracle

    Add email notification tasklist using SOA API

    Vsegu-Oracle

      Hi,

       

        We have an urgent requirement to add email notification tasklist using SOA API. Could you please help to provide documentation on this.

      I tried below code , didnot work.

       

      import oracle.bpel.services.common.util.XMLUtil;

      import oracle.bpel.services.workflow.client.IWorkflowServiceClient;

      import oracle.bpel.services.workflow.client.WorkflowServiceClientFactory;

      import oracle.bpel.services.workflow.task.IInitiateTaskResponse;

      import oracle.bpel.services.workflow.task.ITaskService;

      import oracle.bpel.services.workflow.task.model.ObjectFactory;

      import oracle.bpel.services.workflow.task.model.Task;

      import org.w3c.dom.Document;

      import org.w3c.dom.Element;

       

      public class MergeNotification

      {

        public static final String TASK_NS = "http://xmlns.oracle.com/bpel/workflow/task";

       

        public void RaiseNotification() {

          ObjectFactory objectFactory = new ObjectFactory();

          Task task = objectFactory.createTask();

       

         

          task.setTitle("Merge Notification");

         

          task.setCreator("jcooper");

       

          task.setTaskDefinitionId("http://xmlns.oracle.com/bpel/workflow/task");

         

          try {

            Document document = XMLUtil.createDocument();

            Element payloadElem = document.createElementNS("http://xmlns.oracle.com/bpel/workflow/task", "payload");

            Element vacationRequestElem = document.createElementNS("http://xmlns.oracle.com/bpel/workflow/task", "VacationRequestProcessRequest");

           

            Element creatorChild = document.createElementNS("http://xmlns.oracle.com/bpel/workflow/task", "creator");

            creatorChild.appendChild(document.createTextNode("jcooper"));

            vacationRequestElem.appendChild(creatorChild);

           

            Element fromDateChild = document.createElementNS("http://xmlns.oracle.com/bpel/workflow/task", "fromDate");

            fromDateChild.appendChild(document.createTextNode("2006-08-05T12:00:00"));

            vacationRequestElem.appendChild(fromDateChild);

           

            Element toDateChild = document.createElementNS("http://xmlns.oracle.com/bpel/workflow/task", "toDate");

            toDateChild.appendChild(document.createTextNode("2006-08-08T12:00:00"));

            vacationRequestElem.appendChild(toDateChild);

           

            Element reasonChild = document.createElementNS("http://xmlns.oracle.com/bpel/workflow/task", "reason");

            reasonChild.appendChild(document.createTextNode("Hunting"));

            vacationRequestElem.appendChild(reasonChild);

           

            payloadElem.appendChild(vacationRequestElem);

            document.appendChild(payloadElem);

           

            task.setPayloadAsElement(payloadElem);

           

            IWorkflowServiceClient workflowServiceClient = WorkflowServiceClientFactory.getWorkflowServiceClient("SOAP");

       

           

            ITaskService taskService = workflowServiceClient.getTaskService();

            IInitiateTaskResponse iInitiateTaskResponse = taskService.initiateTask(task);

            Task retTask = iInitiateTaskResponse.getTask();

            System.out.println("Initiated: " + retTask.getSystemAttributes().getTaskNumber() + " - " + retTask.getSystemAttributes().getTaskId());

         

          }

          catch (Exception ex) {

            System.out.println("exveption");

          }

        }

      }