AJAX (jQuery) and Alfresco WebScript
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2008 06:58 AM
I got Alfresco 2.1 installed on a linux server inside an Intranet.
I made a Web Script which browse alfresco folders and gives and personalized xml as output
(I started from the sample available "get.atom" http://wiki.alfresco.com/wiki/Web_Scripts_Examples#Folder_Browse.2FRSS_Feed )
Now I need to read this XML output on company Intranet Portal Site using javascript.
I use jQuery libraries and personalized scripts. Those scripts usually read physical XML loaded on portal server.
Alfresco Webscripts needs authentication…
- There's a way to get authenticated through Javascript ?
- Should I move original documents to VCM area to remove authentication ?
- There's a space inside alfresco where authentication is not needed ?
- Or better, could I write my XML output physically inside a VCM folder and deplay it on another server I choose, in this case portal server ?
Any help will be appreciated
I made a Web Script which browse alfresco folders and gives and personalized xml as output
(I started from the sample available "get.atom" http://wiki.alfresco.com/wiki/Web_Scripts_Examples#Folder_Browse.2FRSS_Feed )
Now I need to read this XML output on company Intranet Portal Site using javascript.
I use jQuery libraries and personalized scripts. Those scripts usually read physical XML loaded on portal server.
Alfresco Webscripts needs authentication…
- There's a way to get authenticated through Javascript ?
- Should I move original documents to VCM area to remove authentication ?
- There's a space inside alfresco where authentication is not needed ?
- Or better, could I write my XML output physically inside a VCM folder and deplay it on another server I choose, in this case portal server ?
Any help will be appreciated
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2008 10:14 AM
You have several options as you list, however I belive HTTP basic authentication may be the best option. Take a look at this post - http://forums.alfresco.com/en/viewtopic.php?f=12&t=11970
As Peter notes, HTTP basic authentication is used for authenticating Web Scripts accessed via /alfresco/service (see http://wiki.alfresco.com/wiki/Web_Scripts#Invoking_a_Web_Script).
Be aware of cross domain scripting issues with the jQuery requests, you may need some type of proxy.
Regards, Ben.
As Peter notes, HTTP basic authentication is used for authenticating Web Scripts accessed via /alfresco/service (see http://wiki.alfresco.com/wiki/Web_Scripts#Invoking_a_Web_Script).
Be aware of cross domain scripting issues with the jQuery requests, you may need some type of proxy.
Regards, Ben.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2009 09:09 AM
Hi Ben,
I solved te cross domain issue using json approch:
For info: http://chamnapchhorn.blogspot.com/2008/07/jquery-cross-domain-ajax-query.html
I solved the authentication problems creating a special user called "alfresco_srv" and using a ticket approch:
http://<host>:<port>/<contextPath>/<servicePath>/api/path/Workspace/SpacesStore/Company%20Home/children?alf_ticket=<ticket>
HERE IS HOW EVERYTHING WORKS:
I ask alfresco for the needed json file using and Ajax call with ticket.
The json contains all the neeed information, filename, modified date, author and more
once i get the file, jQuery will convert everything into HTML and insert the output inside the page.
That's all
I solved te cross domain issue using json approch:
For info: http://chamnapchhorn.blogspot.com/2008/07/jquery-cross-domain-ajax-query.html
I solved the authentication problems creating a special user called "alfresco_srv" and using a ticket approch:
http://<host>:<port>/<contextPath>/<servicePath>/api/path/Workspace/SpacesStore/Company%20Home/children?alf_ticket=<ticket>
HERE IS HOW EVERYTHING WORKS:
I ask alfresco for the needed json file using and Ajax call with ticket.
The json contains all the neeed information, filename, modified date, author and more
once i get the file, jQuery will convert everything into HTML and insert the output inside the page.
That's all
