Book Image

Alfresco 3 Web Services

Book Image

Alfresco 3 Web Services

Overview of this book

Alfresco 3 is the leading open source enterprise content management system that offers powerful features for interacting with the content in its repository from outside the system. These include the support for the Content Management Interoperability Services (CMIS) implementation, reusable web scripts, and a Web Services API. This is the first book to show you how to use Web Services in Alfresco. Packed with examples, you'll learn how to build applications using Alfresco remote APIs based on SOAP and REST. You'll see how to use different APIs and bindings such as WebServices, WebScripts, and CMIS. Alfresco 3 Web Services starts off by showing you the services exposed by the Alfresco Web Services API, and how the API fits into the Alfresco software architecture.You learn to develop your application firstly by setting up and testing your Java development environment using the Alfresco SDK in Eclipse IDE and secondly by associating the Alfresco source code and Javadocs in Eclipse.With the help of real world practical examples, you learn how to do things like create, sort, and call Web Scripts, and invoke remote calls to Alfresco repository. To get the most from the Web Services API, you need to know about the basics of the Content Manipulation Language (CML), and the book takes you through this.Examples such as the bookshop application show you how to sign in, change user sessions, get, remove and change public and private associated contents, manage a cart for your e-commerce application, and so on.Next, by implementing a Microsoft .NET application using the Alfresco Web Services API, you see how to perform operations against the repository from your .NET application.The book provides you with REST and SOAP concepts, their comparison, basics of the FreeMarker language, Atom Publishing Protocol, JavaScript controllers, and the Apache Chemistry project.By the end of this book, you will be able to put together your knowledge about CMIS and the Apache Chemistry toolkit to develop a complete working application that uses Alfresco, via CMIS, as a back-end storage. Last but not the least, this book also covers the WebServices security profiles— the best practices for Web Services to promote better interoperability.
Table of Contents (20 chapters)
Alfresco 3 Web Services
Credits
About the Authors
About the Reviewers
Preface
Free Chapter
1
Introducing the SOAP Web Services API

Aspects


An aspect consists of a group of properties that can be added to and removed from a node on the fly.

Adding aspects

Alfresco cannot manage versioning for you, if you haven't added the versionable aspect to the node. You can add it before creating a new version, in the following way:

//add versionable aspect to the node
CMLAddAspect aspect = new CMLAddAspect();
aspect.setAspect(Constants.ASPECT_VERSIONABLE);
aspect.setWhere(sourcePredicate);
//update node
CMLUpdate update = new CMLUpdate();
update.setProperty(buildCustomProperties(createSampleVo));
update.setWhere(sourcePredicate);
CML cmlUpdate = new CML();
cmlUpdate.setAddAspect(new CMLAddAspect[]{aspect});
cmlUpdate.setUpdate(new CMLUpdate[]{update});
//perform a CML update
WebServiceFactory.getRepositoryService().update(cmlUpdate);

Now, for each update to one of the nodes defined in the sourcePredicate, Alfresco will create a new version of the node.

Removing aspects

In the previous section, you learned how to add an aspect to enable...