Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alfresco workflow trigger through java code

I want to develop an app preferbly on servlet environment . I want to trigger alfresco out of box workflow webscripts from my app. Alfresco has provided restful URL for doing that.

can anyone tell me how do i invoke the rest URL to invoke the webscripts from my java code.

can anyone pls give me a sample code or manual for that as I have limited experience in webservice.

I need bit clear and detailed explaination..

Thanks

like image 495
Padmanabha Vn Avatar asked Dec 04 '22 06:12

Padmanabha Vn


1 Answers

You could use the Apache HTTP Client library to perform RESTful (JSON requests/posts).

Here is a tutorial how to do a post/get to an Alfresco like server: RESTful Java client

Replace the example url's with the Alfresco urls defined in the Workflow REST API. Furthermore before you do all this, you need to authenticate to Alfresco.

  1. Use the same HTTP Client example to get the ticket with url http://localhost:8080/alfresco/service/api/login?u=admin&pw=admin
  2. You will get a response like: <ticket>TICKET_887add1e01b5c4c0cd58ac11c768f8e54c1eabf4</ticket>
  3. Save the ticket value of the element in a Java variable
  4. Use the ticket with one of the workflow REST API services e.g. http://localhost:8080/alfresco/service/api/workflow-definitions so present the Ticket like following: http://localhost:8080/alfresco/service/api/workflow-definitions?alf_ticket=TICKET_887add1e01b5c4c0cd58ac11c768f8e54c1eabf4
  5. Do whatever you'd like with the result :)
like image 57
Tahir Malik Avatar answered Dec 05 '22 20:12

Tahir Malik