cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow Web Service APIs

tarunbajaj_007
Champ in-the-making
Champ in-the-making
Hi,

Can anyone please inform that is there any way with which I can invoke the workflow APIs from outside Alfresco?
I have a scenario where I will be having  a web application which would be using the core workflow and content management functionalities of Alfresco repository.

so in that case, how do I invoke the workflow APIs(is it possible thru web service APIs)

Regards
Tarun
11 REPLIES 11

sdavis
Champ in-the-making
Champ in-the-making
Depends on which version you're using.  As of 2.9, you can use http://wiki.alfresco.com/wiki/Workflow_JavaScript_API in conjunction with http://wiki.alfresco.com/wiki/Web_Scripts to expose Workflow features outside of Alfresco.

subwiz
Champ in-the-making
Champ in-the-making
We are using Alfresco 2.2 Enterprise. How do we access workflow APIs in this version?

luisalves00
Champ in-the-making
Champ in-the-making
Hello,

I'm using Alfresco 3.3. Is there any guide explaining how to accomplish this "feature", i.e., using Alfresco as a backend for workflows?

regards

pedro_kowalski
Champ in-the-making
Champ in-the-making
I would also like to know what is the suggested approach to use Alfresco just as a workflow backend manager.

The CMIS does not expose any services related with workflow, and these are most interested for me.

Thanks in advance!

dynamolalit
Champ on-the-rise
Champ on-the-rise
Hi All,

Even i need the same functionality to get handle of a workflow in custom web service.

Till now i am not able to get it .

Do anybody knows how to get WorkflowService in web service.

mrogers
Star Contributor
Star Contributor
Workflow is not exposed via WebService.

If you want to use web services then I believe a few people have had success with running actions which interact with Workflow.

The recommended remote interface for alfresco is via Web Script.   Alfresco already has a collection of web scripts for workflow.   They are how the tasks pannel in Share works.  

Alfresco 3.4 or whatever it will be called, contains far more of a workflow API.

dynamolalit
Champ on-the-rise
Champ on-the-rise
Hi mrogers ,

Thanks for your clarification.It cleared the air a lot.

The missing part as i think while using web services in current format is the creation of a custom aspect setting approver group details or any other details required, in your custom content model & set it while workflow is executing either in java script or in actionhandler.Once set, you can get it anywhere you want including custom web service.

OR Alternatively

Create a SOAP based wrapper around a REST based web script to expose such functionalities which are not provided in web services as below.


public class AlfCustomWebService{

        private static final long serialVersionUID = 1L;
   private String ticket;
   private HttpURLConnection conn = null;

public String getUserList() {
                 //Getting property from alfresco-global.properties file.
      WsPropertyReader propertyReader = new WsPropertyReader();
      String adminUsername = propertyReader.getProperty("admin.username");
      String adminPassword = propertyReader.getProperty("admin.password");
      String wsEndPoint = propertyReader.getProperty("alfresco.ws.endpoint");
      String webScriptUrl = propertyReader.getProperty("webscripturl");
      String webScriptMethod = propertyReader.getProperty("webscriptmethod");
      try {      
         //Startting session & setting endpoint.
         AuthenticationUtils.startSession(adminUsername, adminPassword);
         WebServiceFactory.setEndpointAddress(wsEndPoint);
         setTicket(AuthenticationUtils.getTicket());
         //Creating URL for web script.
         URL scriptUrl = (new URI(webScriptUrl)).toURL();
         logger.debug("Invoking Web Script : " + scriptUrl);
         //Getting connection & setting properties for same.
         conn = (HttpURLConnection) scriptUrl.openConnection();
         conn.setRequestMethod(webScriptMethod);
         conn.setRequestProperty("Authorization", "Basic "+ Base64.encodeBytes((getTicket()).getBytes()));
         conn.connect();
         //Checking for response from web script.
         logger.debug("Response code : " + conn.getResponseCode());
         //Getting response as a string.
         BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
         StringBuffer buffer = new StringBuffer();
         String line;
         while ((line = in.readLine()) != null) {
            buffer.append(line);
         }
         String result = buffer.toString();
                    }
             }

Alfresco 3.4 or whatever it will be called, contains far more of a workflow API.

Can you explain a bit more about it.

Also, Alfresco put great stress on web scripts but in real time implementation , web services are very much needed , both from client requirement perspective & for integrating two heterogeneous systems.If user tries to invoke web scripts from third party systems, it require that users  write some kind of invoker classes & use them on other system than Alfresco where Alfresco needs to be accessed but web services provide WSDLs which can be used independently.Also, if i try to access web script on a third party system, i need to put dependency jars on other system making it a bit complex, which i think , can be avoided using web service.Correct me if i am wrong here.

Do you guys planning to give more powers to web services in future?

mrogers
Star Contributor
Star Contributor
Administrator:  Please ban the above spammer.

hsohaib
Champ on-the-rise
Champ on-the-rise
Also, Alfresco put great stress on web scripts but in real time implementation , web services are very much needed , both from client requirement perspective & for integrating two heterogeneous systems.If user tries to invoke web scripts from third party systems, it require that users  write some kind of invoker classes & use them on other system than Alfresco where Alfresco needs to be accessed but web services provide WSDLs which can be used independently.Also, if i try to access web script on a third party system, i need to put dependency jars on other system making it a bit complex, which i think , can be avoided using web service.Correct me if i am wrong here.

Do you guys planning to give more powers to web services in future?

You don't need any dependency jars to invoke a webscript, and it can be seen as a RESTFUL Web Service, you juste have to provide the response as SOAP.
I exposed some workflow functions via WebScript to use it from another web application (start process, fetch tasks …) and it worked great.