cancel
Showing results for 
Search instead for 
Did you mean: 

How can i send alfresco web script output to liferay?

itsjjonnet
Champ in-the-making
Champ in-the-making
Hi,

I want to know how can i call my webscript from liferay & send webscript output back.

What formats i can have?
7 REPLIES 7

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

You can look at this post of mine @

http://forums.alfresco.com/en/viewtopic.php?f=36&t=26649

It can help you out.

sanket
Champ on-the-rise
Champ on-the-rise
Which webscript you want to use ?

I mean what action you want to perform on alfresco side by using webscript ?

itsjjonnet
Champ in-the-making
Champ in-the-making
Hi Sanket,

Thanks for your reply.

I want to expose a webscript to liferay so that on a portlet from liferay, a link is clicked resulting in invoking that web script.Once successfully invoked, the output which is an HTML content, should be displayed on the portlet.

Will appreciate for any suggestion on this?

sanket
Champ on-the-rise
Champ on-the-rise
So I guess you want to read some content (or file) from alfresco and display it in your liferay portlet.
For that, u need to pass the node-id of the file you want to read - when u make a call to alfresco.

Web script will accept that node-id, process the request, prepare the response and send the html content back - in the form of response.

This java code will help u reading content from alfresco file.
Note: "project_node_id" is the node-id of the file you want to read.

   
      String lStrParentUuid = request.getParameter("project_node_id")!=null ? request.getParameter("project_node_id") : "";
      ContentReader cr = getContentService().getReader(lStrParentUuid , ContentModel.PROP_CONTENT);
          content = cr.getContentInputStream();

      
       response.getWriter().write("<ReadContent>"+content+"</ReadContent>");

You can store   cr.getContentInputStream()   in byte array and send to response.Something like this.
byte b[] = cr.getContentInputStream().toString().getBytes();
          BufferedInputStream bis = new BufferedInputStream(cr.getContentInputStream());
              StringBuffer sb = new StringBuffer();
          while (bis.available() > 0)
            {
                 //System.out.print((char)bis.read());
                 sb.append((char)bis.read());
            }

At last - response.getWriter().write("<ReadContent>"+sb+"</ReadContent>");

Hope this helps,
Thanks.

unknown-user
Champ on-the-rise
Champ on-the-rise
Hi,

Please have look at :  http://wiki.rivetlogic.com/display/AWPr/Home

You will need the awpr war for liferay and the star 1.2 amp for alfresco.

Please note i only got it running on alfresco 3.2r2 community.

EDIT:
Star also works on alfresco 3.3.
However i needed to recompile it in eclipse.

anusk
Champ in-the-making
Champ in-the-making
Hi all!
I have the same problem. I want to know how the webscripts integration works, and I want to invoke from a Liferay Portlet a webscript from Alfresco.
I created an example portlet (just Hello world) in liferay, and i would like to call the webscript from that portlet.
The webscript is alfresco/service/cmis/checkedout , and it works perfectly.
So, how can i connect them?
I've read a lot of information about Alfresco and Liferay, but I can't found any steps to achieve this functionallity, and at this point I am really lost.
Any information would be very appreciated!

Kind regards,
Ana