cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco repository data via SURF application

andrepra
Champ in-the-making
Champ in-the-making
Hi,

I'm starting using SURF framework and I've read the wiki and the some tutorials fount on internet. I realized a simple stand alone application understanding the basic concepts. Now I want to go further and I would like to show data (documents and spaces) from Alfresco repository.
I know that is possible to access this data via JSON calls, but I see that it's possible to define connectors to Alfresco repository. Are these connectors useful to perform backend calls (so my surf application act as a proxy) or are used only to configure the locations of surf files (template, component, pages, ..) to work with WCM?
Exists any tutorial that explain how to build this 2 tiers application?

thanks
Andrea
6 REPLIES 6

mikeh
Star Contributor
Star Contributor
By far the best way to learn SURF is to look at the Share source code, which does exactly what you're asking.

Mike

ssaravanan
Champ in-the-making
Champ in-the-making
A good tutorial is available in the wiki for configuring SURF and WCM – http://wiki.alfresco.com/wiki/Surf_Platform_-_Deployment_Configurations
Another very good example for building a sample SURF site is available  http://www.benh.co.uk/alfresco/surf-part-1-getting-started/
The webframework project has a simple sample webscript for making remote calls using connectors, which has to be configured in the
web-framework-config-remote.xml . If data is to be pulled out from DM , then you need to be authenticated, so edit the file to make it
look like this
                     
<endpoint>
            <id>alfresco.com</id>
            <name>alfresco.com website</name>
            <description>The alfresco.com website</description>
            <connector-id>http</connector-id>
            <endpoint-url>http://www.alfresco.com</endpoint-url>
            <identity>none</identity>
         </endpoint>
change to
                     
 <endpoint>
            <id>alfresco</id>
            <name>alfresco.com website</name>
            <description>The alfresco.com website</description>
            <connector-id>http</connector-id>
            <endpoint-url>http://localhost:8080/alfresco/service</endpoint-url>
                                <username>admin</username>
                                 <password>admin</password>
                                 <identity>declared</identity>
            <identity>none</identity>
         </endpoint>

then run alfwf to see the remote connector working.
Hope this helps.

andrepra
Champ in-the-making
Champ in-the-making
Thanks for all replies. I've tried this code

var connector = remote.connect("alfresco");
var indexHtml = connector.get("/sample/folder/Company%20Home/Guest%20Home?guest=true");
and that is what I need.

Thanks again
Andrea

ugocei
Champ in-the-making
Champ in-the-making
Declared identity does not work for me. I've also tried uncommenting the snippet in webscript-framework-config.xml that says:


<endpoint>
   <id>alfresco-system</id>
   <name>Alfresco - System access</name>
   <description>System account access to Alfresco</description>
   <connector-id>alfresco</connector-id>
   <endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
   <identity>declared</identity>
   <username>admin</username>
   <password>admin</password>
   <unsecure>true</unsecure>
</endpoint>

But when I try to use this endpoint, I get an error message that says: "Endpoint alfresco-system is not valid".

ssaravanan
Champ in-the-making
Champ in-the-making
You can find some sample webscripts on webframework project which make remote proxy call
to webscripts

feroz
Champ in-the-making
Champ in-the-making
Hi Andrea,
You said, you get what u need. Where i put that code in the surf project? Give me brief explanation about that.
Thank in advance
with regards,
Feroz