cancel
Showing results for 
Search instead for 
Did you mean: 

HELP: alfresco APIs and Services?

shamabbas
Champ in-the-making
Champ in-the-making
Hi,
I'm trying to integrate alfresco with my own developed application developed in Flex to upload and retrieve files. Please let me know what APIs and Services are being used in alfresco just to upload and retrieve files. And if also can help please let me know how to call these services in my Application. Actually im totally new so need some help. Please!
I'll be very thankful to you.
5 REPLIES 5

gronfelt
Champ in-the-making
Champ in-the-making
I'm really new to this my self, so i apologize if I'm wrong about something, but I hope this might be of some help.

The Webscripts Samples page in the wiki contains an example on how to upload files:

http://wiki.alfresco.com/wiki/Web_Scripts_Examples

As for downloading files there is a property called downloadUrl that applies to document objects, this is detailed out here:

http://wiki.alfresco.com/wiki/3.2_JavaScript_API#ScriptNode_API

So what you might do is to use a web script to retrieve the download URL for the file and then do a http request using the URL to download it.

shamabbas
Champ in-the-making
Champ in-the-making
Hi gronfelt,
Thanks for replying. I have picked code for uploading and downloading files in java from different forums. I'm facing authentication problems now. Session starts and right then end when upload any file. I don't know much about its authentication process but it generates ticket for password to pass which i really don't know how to do.
I asked many places but no help yet. If you'd know something let me know.
Thanks once again. I really appreciate you replied to me. And it will obvisouly help me the javascripts api link you sent. Other webscripts i have already worked in it.
thanks alotz!

sham

lista
Star Contributor
Star Contributor
Hi,

use this method to generate ticket.

Cheers,
Ivan.

shamabbas
Champ in-the-making
Champ in-the-making
hey
thanks for replying i read that and clicked on to get login ticket but i got following page.
I clicked on it
http://localhost:8080/alfresco/service/api/login/ticket/%7Bticket%7D
and showed me page with this…

response>

<status>
404
<name>Not Found</name>
<description>Requested resource is not available.</description>
</status>
<message>Ticket not found</message>
<exception/>
<callstack>
  </callstack>
<server>Alfresco Enterprise v3.1.0 (142) schema 1,008</server>
<time>Sep 8, 2009 2:16:43 PM</time>
</response>

What is the reason?

shamabbas
Champ in-the-making
Champ in-the-making
I'm using java code which was pasted here in forums to upload files in alfresco repository. Part of code is given below which is used for authentication purpose


               WebServiceFactory.setEndpointAddress("http://localhost:8080/alfresco/api");
                AuthenticationUtils.startSession("admin", "admin");
                System.out.println("Ticket::" + AuthenticationUtils.getTicket());


But gave me following exception.


14:21:08,825 INFO  [STDOUT] inside try
14:21:08,825 INFO  [STDOUT] For Testing Values..
14:21:08,825 INFO  [STDOUT] title::Valuetitleee
14:21:08,825 INFO  [STDOUT] title:titleee
14:21:08,825 INFO  [STDOUT] Description:desppp
14:21:08,825 INFO  [STDOUT] file name:test_file.doc
14:21:08,825 INFO  [STDOUT] file name :test_file.doc
14:21:08,825 INFO  [STDOUT] ext name :doc
14:21:09,183 INFO  [STDOUT] inside alfresco part:…
14:21:09,183 INFO  [STDOUT] Ticket::null
14:21:09,199 INFO  [STDOUT] Association type:::{http://www.alfresco.org/model/content/1.0}contains
14:21:09,199 INFO  [STDOUT] ChiledName:::null
14:21:09,199 INFO  [STDOUT] Path:::::/app:company_home/cm:myweb
14:21:09,199 INFO  [STDOUT] Chile Name :::cm:test_file.doc
14:21:09,199 INFO  [STDOUT] Aspect::{http://www.alfresco.org/model/content/1.0}titled
14:21:09,199 INFO  [STDOUT] Property::[Lorg.alfresco.webservice.types.NamedValue;@1194b01
14:21:09,199 INFO  [STDOUT] Wherenull
14:21:09,199 INFO  [STDOUT] after CMLcreate:::
14:21:09,199 INFO  [STDOUT] after Add Aspect:::
14:21:09,199 INFO  [STDOUT] befor resultset::::
14:21:09,199 INFO  [STDOUT] Header::[Lorg.apache.axis.message.SOAPHeaderElement;@18b3665
14:21:09,635 INFO  [STDOUT] Error uploading file:::org.apache.ws.security.WSSecurityException: WSHandler: password callback failed; nested exception is:
        org.alfresco.webservice.util.WebServiceException: Ticket could not be found when calling callback handler.
14:21:09,635 ERROR [STDERR] org.apache.ws.security.WSSecurityException: WSHandler: password callback failed; nested exception is:
        org.alfresco.webservice.util.WebServiceException: Ticket could not be found when calling callback handler.
14:21:09,635 ERROR [STDERR]     at org.apache.ws.security.handler.WSHandler.performCallback(WSHandler.java:736)
14:21:09,635 ERROR [STDERR]     at org.apache.ws.security.handler.WSHandler.readPwViaCallbackClass(WSHandler.java:712)
14:21:09,635 ERROR [STDERR]     at org.apache.ws.security.handler.WSHandler.getPassword(WSHandler.java:670)
14:21:09,635 ERROR [STDERR]     at org.apache.ws.security.action.UsernameTokenAction.execute(UsernameTokenAction.java:35)
14:21:09,635 ERROR [STDERR]     at org.apache.ws.security.handler.WSHandler.doSenderAction(WSHandler.java:197)
14:21:09,635 ERROR [STDERR]     at org.apache.ws.axis.security.WSDoAllSender.invoke(WSDoAllSender.java:170)
14:21:09,635 ERROR [STDERR]     at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
14:21:09,635 ERROR [STDERR]     at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
14:21:09,635 ERROR [STDERR]     at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
14:21:09,635 ERROR [STDERR]     at org.apache.axis.client.AxisClient.invoke(AxisClient.java:127)
14:21:09,635 ERROR [STDERR]     at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
14:21:09,635 ERROR [STDERR]     at org.apache.axis.client.Call.invoke(Call.java:2767)
14:21:09,635 ERROR [STDERR]     at org.apache.axis.client.Call.invoke(Call.java:2443)
14:21:09,635 ERROR [STDERR]     at org.apache.axis.client.Call.invoke(Call.java:2366)
14:21:09,635 ERROR [STDERR]     at org.apache.axis.client.Call.invoke(Call.java:1812)
14:21:09,635 ERROR [STDERR]     at org.alfresco.webservice.repository.RepositoryServiceSoapBindingStub.update(RepositoryServiceSoapBindingStub.java:986)
14:21:09,650 ERROR [STDERR]     at upload.doPost(upload.java:198)
14:21:09,650 ERROR [STDERR]     at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
14:21:09,650 ERROR [STDERR]     at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
14:21:09,650 ERROR [STDERR]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
14:21:09,650 ERROR [STDERR]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
14:21:09,650 ERROR [STDERR]     at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
14:21:09,650 ERROR [STDERR]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
14:21:09,650 ERROR [STDERR]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
14:21:09,650 ERROR [STDERR]     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
14:21:09,650 ERROR [STDERR]     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
14:21:09,650 ERROR [STDERR]     at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
14:21:09,650 ERROR [STDERR]     at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
14:21:09,650 ERROR [STDERR]     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
14:21:09,650 ERROR [STDERR]     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
14:21:09,650 ERROR [STDERR]     at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
14:21:09,650 ERROR [STDERR]     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
14:21:09,650 ERROR [STDERR]     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
14:21:09,650 ERROR [STDERR]     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
14:21:09,650 ERROR [STDERR]     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
14:21:09,650 ERROR [STDERR]     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
14:21:09,650 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:619)
14:21:09,650 ERROR [STDERR] Caused by: org.alfresco.webservice.util.WebServiceException: Ticket could not be found when calling callback handler.
14:21:09,650 ERROR [STDERR]     at org.alfresco.webservice.util.AuthenticationUtils.handle(AuthenticationUtils.java:171)
14:21:09,650 ERROR [STDERR]     at org.apache.ws.security.handler.WSHandler.performCallback(WSHandler.java:734)
14:21:09,650 ERROR [STDERR]     … 36 more
14:21:09,650 INFO  [STDOUT] [Ljava.lang.StackTraceElement;@20618a
14:21:09,650 INFO  [STDOUT] org.apache.ws.security.WSSecurityException: WSHandler: password callback failed; nested exception is:
        org.alfresco.webservice.util.WebServiceException: Ticket could not be found when calling callback handler.
14:21:09,650 INFO  [STDOUT] session ending

If you know anything about it how to resolve please let me know as soon as possible il b very thankful to you.