Home

In the previous post we have learned about what are webscripts and its role in Alfresco. In this post I will explain how to create a simple webscript in Alfresco. We are going to create Alfresco JavaScript based webscript. Here we are creating webscript which fetch all the document of particular type from repository and return html file with all those properties.

Step1:

Create WebScript Description file getDocs.get.desc.xml

1
2
3
4
5
6
7
8
9
10
11
12
<alfresco-config>
   <config evaluator="string-compare" condition="WebFramework">
      <web-framework>
         <defaults>
            <page-type>
               <id>login</id>
               <page-instance-id>custom-login</page-instance-id>
            </page-type>
         </defaults>
      </web-framework>
   </config>
</alfresco-config>

Step2:

Create Webscript  javascript controller file getDocs.get.js

1
2
3
4
<page>
   <template-instance>custom-login</template-instance>
   <authentication>none</authentication>
</page>

Step3:

Create Freemarker Template File getDocs.get.html.ftl

1
2
3
4
<page>
   <template-instance>custom-login</template-instance>
   <authentication>none</authentication>
</page>

 Step4:

Upload all three files under you alfresco installation under following path

CompanyHome>Data Dictionary> Web Scripts Extensions

Step5:

Restart the server hit this url

http://<host&gt;:<port>/alfresco/service/fetchdocs

You are good to go to test above webscript you need to hit this url in your browser you will see list of documents of custom content type.

This type of webscripts is very powerful tool to expose alfresco webscript to external application. It is lightweight. It is easy to create and deploy and update. You can deploy your changes on the fly without restarting the server that is the best thing about this type of webscript.

Looking for quality Alfresco Hosting?  Look no further than Arvixe Web Hosting!

Publicités

Laisser un commentaire

Choisissez une méthode de connexion pour poster votre commentaire:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion / Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion / Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion / Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion / Changer )

Connexion à %s