cancel
Showing results for 
Search instead for 
Did you mean: 

Remote Alfresco API rivet

rivetlogic
Champ on-the-rise
Champ on-the-rise
RAAr

RAAr is an abstraction layer for remote communication with Alfresco ECM. RAAr provides a simple, Java-based local library that may be used by one or more content rich applications and allows these applications to interface to Alfresco (including multiple Alfresco repositories from the same application). RAAr's lower layers handle communication to remote Alfresco instances over ReSTful calls to Alfresco that get mapped to calls to the Alfresco Foundation Services (AFS) API.

Motivation for RAAr

Certain classes of content rich applications require one or more of the following:

    * Remote full coverage of the AFS API (e.g., version management and version history traversal, dictionary services for model introspection, multi-store access, etc.)
    * Streaming content directly from the application and not from Alfresco (i.e., not using download servlet)
    * SSO support
    * Middle-tier business logic within the application where not all processing is done on Alfresco app server
    * Support for un-marshalling of result sets
RAAr lives here:
http://wiki.rivetlogic.org/display/RAAR/

Feel free to ask questions about RAAr in this thread.

–Sumer
112 REPLIES 112

itsard
Champ in-the-making
Champ in-the-making
Hi,
Thanks for the reply
Now the error is :

com.rivetlogic.core.cma.exception.AuthenticationFailure: com.rivetlogic.core.cma.exception.CmaRuntimeException: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <title>Web Script Status 404 - Not Found</title>
      <link rel="stylesheet" href="/alfresco/css/base.css" type="text/css" />
   </head>
   <body>
      <div>
         <table>
            <tr>
               <td><img src="/alfresco/images/logo/AlfrescoLogo32.png" alt="Alfresco" /></td>
               <td><span class="title">Web Script Status 404 - Not Found</span></td>
            </tr>
         </table>
         <br/>
         <table>
            <tr><td>The Web Script <a href="/alfresco/service/cma/authenticationservice">/alfresco/service/cma/authenticationservice</a> has responded with a status of 404 - Not Found.</td></tr>
         </table>
         <br/>
         <table>
            <tr><td><b>404 Description:</b></td><td> Requested resource is not available.</td></tr>
            <tr><td> </td></tr>
            <tr><td><b>Message:</b></td><td>Script url /cma/authenticationservice does not map to a Web Script.</td></tr>
            <tr><td></td><td> </td></tr>
   <tr><td><b>Exception:</b></td><td>org.alfresco.web.scripts.WebScriptException - Script url /cma/authenticationservice does not map to a Web Script.</td></tr>
   <tr><td></td><td> </td></tr>
         <tr><td></td><td>org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:106)</td></tr>
         <tr><td></td><td>org.alfresco.web.scripts.servlet.WebScriptServlet.service(WebScriptServlet.java:116)</td></tr>
         <tr><td></td><td>javax.servlet.http.HttpServlet.service(HttpServlet.java:717)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)</td></tr>
         <tr><td></td><td>org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)</td></tr>
         <tr><td></td><td>org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)</td></tr>
         <tr><td></td><td>org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)</td></tr>
         <tr><td></td><td>org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)</td></tr>
         <tr><td></td><td>org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)</td></tr>
         <tr><td></td><td>java.lang.Thread.run(Thread.java:595)</td></tr>
   <tr><td></td><td> </td></tr>
            <tr><td><b>Server</b>:</td><td>Alfresco Labs v3.0.0 (Stable 1526) schema 1,002</td></tr>
            <tr><td><b>Time</b>:</td><td>Jul 14, 2009 6:52:55 AM</td></tr>
            <tr><td></td><td> </td></tr>
         </table>
      </div>
   </body>
</html>


   at com.rivetlogic.core.cma.impl.AuthenticationServiceImpl.authenticate(AuthenticationServiceImpl.java:118)
   at com.alfresco.RivetContent.main(RivetContent.java:22)
Caused by: com.rivetlogic.core.cma.exception.CmaRuntimeException: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <title>Web Script Status 404 - Not Found</title>
      <link rel="stylesheet" href="/alfresco/css/base.css" type="text/css" />
   </head>
   <body>
      <div>
         <table>
            <tr>
               <td><img src="/alfresco/images/logo/AlfrescoLogo32.png" alt="Alfresco" /></td>
               <td><span class="title">Web Script Status 404 - Not Found</span></td>
            </tr>
         </table>
         <br/>
         <table>
            <tr><td>The Web Script <a href="/alfresco/service/cma/authenticationservice">/alfresco/service/cma/authenticationservice</a> has responded with a status of 404 - Not Found.</td></tr>
         </table>
         <br/>
         <table>
            <tr><td><b>404 Description:</b></td><td> Requested resource is not available.</td></tr>
            <tr><td> </td></tr>
            <tr><td><b>Message:</b></td><td>Script url /cma/authenticationservice does not map to a Web Script.</td></tr>
            <tr><td></td><td> </td></tr>
   <tr><td><b>Exception:</b></td><td>org.alfresco.web.scripts.WebScriptException - Script url /cma/authenticationservice does not map to a Web Script.</td></tr>
   <tr><td></td><td> </td></tr>
         <tr><td></td><td>org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:106)</td></tr>
         <tr><td></td><td>org.alfresco.web.scripts.servlet.WebScriptServlet.service(WebScriptServlet.java:116)</td></tr>
         <tr><td></td><td>javax.servlet.http.HttpServlet.service(HttpServlet.java:717)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)</td></tr>
         <tr><td></td><td>org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)</td></tr>
         <tr><td></td><td>org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)</td></tr>
         <tr><td></td><td>org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)</td></tr>
         <tr><td></td><td>org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)</td></tr>
         <tr><td></td><td>org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)</td></tr>
         <tr><td></td><td>java.lang.Thread.run(Thread.java:595)</td></tr>
   <tr><td></td><td> </td></tr>
            <tr><td><b>Server</b>:</td><td>Alfresco Labs v3.0.0 (Stable 1526) schema 1,002</td></tr>
            <tr><td><b>Time</b>:</td><td>Jul 14, 2009 6:52:55 AM</td></tr>
            <tr><td></td><td> </td></tr>
         </table>
      </div>
   </body>
</html>


   at com.rivetlogic.core.cma.rest.impl.RestExecuterImpl.processResponse(RestExecuterImpl.java:389)
   at com.rivetlogic.core.cma.rest.impl.RestExecuterImpl.processResponse(RestExecuterImpl.java:324)
   at com.rivetlogic.core.cma.rest.impl.RestExecuterImpl.execute(RestExecuterImpl.java:142)
   at com.rivetlogic.core.cma.rest.impl.RestExecuterImpl.execute(RestExecuterImpl.java:124)
   at com.rivetlogic.core.cma.impl.AuthenticationServiceImpl.authenticate(AuthenticationServiceImpl.java:113)
   … 1 more

Kindly let me know if I am missing on something

rivetlogic
Champ on-the-rise
Champ on-the-rise
Some questions:
    What version of RAAr are you using?
    What version of Alfresco are you using (specify which edition too (community/enterprise))?
    Did you install the RAAr AMP module in Alfresco?
–Sumer

itsard
Champ in-the-making
Champ in-the-making
alfresco 3.0 stable community edition
raar version is 1.11.0… have used following jars…cma-api-1.11.0.jar and cma-impl-1.11.0.jar
Have deployed cma-alfresco-1.11.0.amp in alfresco.

itsard
Champ in-the-making
Champ in-the-making
Hey,
Thanks for all the help.For some reason the amp module wasnt getting deployed.Now that error is solved.Thanks again.
I wish to know which one to use of the two : web service api provided by alfresco or the rivet api.
My concern for now is the authentication and ticket validation in web service api. I found that in every api call in rivet apis a ticket is provided.
Whereas in alfresco web service api there is no such way, and you need to pass the username and password for every api call.
We wish to integrate alfresco dms with our system and for that we would be calling the DMS api from our project deployed in oc4j app server.
Please throw some light on it. What are the other pros and cons.
Thanks.

rivetlogic
Champ on-the-rise
Champ on-the-rise
There are many ways to remote to Alfresco.

WebScripts is the one I think you're referring to. It requires you build out the server side with handlers (usually in JavaScript) and you invoke those RESTfully. When things get sophisticated, you'll start to marshal and unmarshal parameters and results and you'll have to create many scripts to give you more coverage of the repository.

RAAr makes remoting Alfresco easier by taking care of marshalling/unmarshalling the parameters/results and talking REST to Alfresco. It's also backed by a Java on the Alfresco side for speed (RAAr is fast), and a Java client library to make programming easier. RAAr uses Java-based WebScripts to talk to the repository, so it's really a layer above the first approach.

SOAP is another approach, but I don't think you're referring to this one.

With regard to authentication, you'll need to pass the ticket with every request in all the above. RAAr and SOAP store the ticket on your behalf and pass it with the requests, whereas the WebScripts approach, you'll need to do it yourself. In other words, using WebScripts alone, you'll need to authenticate, get a ticket and then pass that in with every request. For more details on that, I recommend reading through the WebScript programming documentation on Alfresco's wiki.

Cheers.

S

itsard
Champ in-the-making
Champ in-the-making
Hi,
By web service api provided by alfresco I meant the SOAP. I have implemented some basic SOAP webservice apis as on the link http://wiki.alfresco.com/wiki/Alfresco_Content_Management_Web_Services.

Our requirement is calling the DMS apis of alfresco from my project deployed in oc4j server.
The user might log in just once in my system and his authentication should be allowed in alfresco server and for
subsequent calls the ticket should be validated so that he doesnt need to pass the login name and pwd again.
Which of the two options for api to go for?
All the documents stored in alfresco should be saved or updated through that users credentials and not through a
single admin login so that the track can be maintained.

I use the AuthenticationUtils.startsession(uname,pwd) for authentication but by this approach I would have to pass the password everytime.
Rivet apis have a ticket parameter while SOAP apis dont. Can you guide me on this?
Thanks.

rivetlogic
Champ on-the-rise
Champ on-the-rise
I think I understand where the problem is.

The AuthenticationUtils will place the ticket in a ThreadLocal variable and that thread will always be able to make subsequent messages using the "hidden" ticket if you will.

This of course might cause problems in an app where you have different threads servicing the same user (like a web app, where the container might allocate different threads to handle the different requests).

You can get around this by storing the ticket somewhere and setting it before making calls.

That said, I think you should consider 2 key factors first:
1. Does the SOAP API provide you all the coverage you need? In other words, does it have all the method calls you need to get your work done?
2. Is it fast enough (I can tell you that in my experience it hasn't been fast enough for certain apps)

Cheers.

S

itsard
Champ in-the-making
Champ in-the-making
You can get around this by storing the ticket somewhere and setting it before making calls.
I get the ticket by below LOC.
String ticket =AuthenticationUtils.getTicket();
How do i set it before making calls. AuthenticationUtils does not provide an api to set ticket.Neither the repository, content and other
apis have ticket as parameter.Please let me know the code for setting the ticket in subsequent calls.

1. Does the SOAP API provide you all the coverage you need? In other words, does it have all the method calls you need to get your work done?
2. Is it fast enough (I can tell you that in my experience it hasn't been fast enough for certain apps)
All the basic apis have been covered.Does rivet api offer more functionality coverage.If yes, which are those that are not available in SOP api.

And do you mean that rivet apis are faster as compared to SOAP apis?

Thanks

rivetlogic
Champ on-the-rise
Champ on-the-rise
How do i set it before making calls.
I don't recall off the top of my head. I would read through the AuthenticationUtils code to see which ThreadLocal it puts it in and do the same thing.

This is one way to do it. Another way is to keep a copy of the ticket in your code, and check it against what getTicket() returns. If the tickets match, you're still logged in as the same user, if getTicket() returns null, this thread isn't logged in, if the ticket is different, this thread is logged in as a different user. You can take corrective action based on that, but I don't recommend it (it'll be slow and clumsy).

Does rivet api offer more functionality coverage.
Yes it does. I would suggest reading through both APIs to get a feel for the difference.

And do you mean that rivet apis are faster as compared to SOAP apis?
Yes they are.

S

itsard
Champ in-the-making
Champ in-the-making
Hi,
Can I use both : Alfresco SOAP webservice APIs and rivet APIs together in my project for DMS?
Would they work simultaneously?