I am curently developing a java/jee application using Alfresco as ECM. I want to know what is the best way to communicate with alfresco in a Java/jee app.Which is better using the web script or java api ?
-
Use webscripts to remote call like you are calling REST services. Use Java API to build own HTTP services...kinjelom– kinjelom2017-02-26 16:15:06 +00:00Commented Feb 26, 2017 at 16:15
-
i think while i am developing a java/jee app it would be better to use the java api.I think i have the same capabelities as web script.Am i right ?FATMA BEN MOUSSA– FATMA BEN MOUSSA2017-02-26 16:28:20 +00:00Commented Feb 26, 2017 at 16:28
-
Using CMIS is a way more easier with java you will find plannty of methods to help youYagami Light– Yagami Light2017-02-26 20:05:29 +00:00Commented Feb 26, 2017 at 20:05
-
i found this it could be helpfull github.com/Alfresco/alfresco-client-sdkFATMA BEN MOUSSA– FATMA BEN MOUSSA2017-02-26 20:12:10 +00:00Commented Feb 26, 2017 at 20:12
2 Answers
"Web scripts" and "Java" are not mutually exclusive. A web script controller can be coded using Java, JavaScript, or, with a little work, other languages.
So the question you are really asking is: "Should I embed Alfresco in my J2EE application, which would require using the Java API, or should I interact with Alfresco remotely?"
The answer to that is almost certainly that you should interact with it remotely. I don't think anyone is embedding Alfresco in their apps at this point.
Assuming that you are going to interact with Alfresco remotely, the first choice for API should be CMIS, and to do that you should use an existing client library such as OpenCMIS from Apache Chemistry. However, it is unlikely that you will be able to do everything you need to with CMIS, so you can also look at the Alfresco Public REST API. If there are still things you need to be able to do that aren't addressed by either of these, then you can write your own RESTful end points using Web Scripts.
Avoid calling out-of-the-box web scripts unless they are clearly marked as "public".
2 Comments
I would recommend you to use CMIS which is a standard to communicate with ECM solution. One of the advantage is you can replace Alfresco by any other CMIS-compliant solutions. CMIS offers you to connect via REST API or Java (http://chemistry.apache.org/java/opencmis.html)
However, it depends what you really want to do in your application. CMIS don't cover all capabilities offered by Alfresco.