Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Alfresco CMIS
Alfresco CMIS

Alfresco CMIS: Learn how to build applications that talk to content management servers in a standardized way using this superb course on getting the best from Alfresco CMIS. This is a highly practical, step-by-step guide.

eBook
€14.99 €21.99
Paperback
€26.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Alfresco CMIS

Chapter 2. Basic CMIS Operations

In this chapter, we will dig into the CMIS API and test it by calling a CMIS server directly via HTTP, and it will respond in XML or JSON depending on whether we are using the AtomPub binding or the Browser binding. We will try out most of the common operations that would be normal to perform against a CMS system such as follows:

  • Authenticating and connecting to the server

  • Fetching repository information including repository ID and root-folder URL

  • Listing the content of a folder

  • Listing the content types that are available

  • Reading content metadata and downloading content

  • Creating, updating, and deleting folders and files

This chapter is particularly useful for those who cannot, for some reason, use a third-party library that abstracts the inner workings of the CMIS interface. So if you cannot use any of the libraries from the Apache Chemistry project, this chapter will be helpful as it will tell you how to interact with any CMIS-compliant server using only HTTP...

Setting up a CMIS server


Before we start, we are going to need a CMIS server to talk to. There are a number of ways to get access to a CMIS server. You can, for example, install your own or use one that is available on the Internet. Actually, it is best to install your own so that you can have some control over it and you have the confidence that there are not loads of other users doing stuff at the same time as you.

We will focus on the Alfresco content management server in this book, but all the exercises should work with any other CMIS-compliant server too. However, if you use another CMIS server, remember that it will have a different entry point URL than Alfresco's (different from, for example, http://localhost:8080/alfresco/cmisatom).

Installing your own CMIS server

This book is about Alfresco and CMIS, so we will use the Alfresco CMS server when working with CMIS. The quickest way to get going with your own Alfresco installation is to download the full installation file of the Community...

Setting up a tool to make HTTP requests


So we now have an Alfresco CMIS server that we can talk to. Next, we need a tool that can be used to make HTTP requests to the server. We are going to test the AtomPub and Browser CMIS bindings, which are based on the HTTP protocol and the back and forth sending of XML and JSON.

One really good tool that can be used for this is cURL; it is available for most platforms. On my Ubuntu laptop, I can just use the #sudo apt-get install curl command to install it. On Windows, you can download cURL from http://curl.haxx.se/download.html. If you are on a Mac, then Apple has a different version of cURL as part of the developer tools; it's also available through Homebrew using brew install curl.

Later on, in this chapter, we will also look at using the Chrome browser to view XML and JSON responses and some other command-line tools to parse and display XML and JSON.

Authenticating with the repository


When using the AtomPub binding or the Browser binding, authentication is delegated to the transport protocol, which is HTTP. All CMIS-compliant servers must, at the very least, support client authentication using the HTTP Basic authentication schema. We will use this in the following examples. If the server is Alfresco, the alternative is to use the Alfresco login service. As this is not supported by other servers, we will stick to the HTTP Basic authentication, which is portable.

The curl tool can handle Basic Auth for us automatically; we just have to pass the username and password, as follows, with the -u switch when we use curl:

$ curl -u admin:admin

If you are going to work only with Alfresco, you can log in and get a ticket that you can use in subsequent calls as follows:

$ curl "http://localhost:8080/alfresco/service/api/login?u=admin&pw=admin"
<?xml version="1.0" encoding="UTF-8"?>
<ticket>TICKET_39ea5e46e83a6d6e43845182f4254f9de50402fb...

Getting repository information


To execute any other operation against a CMIS repository, we first need to find out its identifier, access points, and capabilities. The identifier is used when we want to connect and get a session to work within. It is also important to know the capabilities of a CMIS server, as not all requirements in the CMIS specification are mandatory, and the capabilities tell us what the repository supports and what it doesn't. The access points tell us how to, for example, get access to the top-level folders in the repository. All this information is accessible via the getRepositoryInfo service call.

Before we look at how to get repository information when using the AtomPub or the Browser binding, we will walk through the different properties that we will encounter and explain them. They are the same for all bindings, so it makes sense to describe them before looking at protocol-specific stuff.

The repository ID, identified by the repositoryId property, is usually needed...

Listing the children of the root folder


After we have the information about the repository via the getRepositoryInfos service, we would typically want to access some folders and files in it. First, you would usually access the children of the top-level folder (also called root folder) in the repository, and this can be done via the getChildren service. This folder is called /Company Home in the Alfresco world.

The getChildren request returns a list of all the folders and files contained in a particular folder. This call has to be supported by the repository, but there are other navigation-related service calls too that might or might not be supported. The getDescendants call will return all the children of a folder to a specified depth. The getFolderTree call will return a complete folder tree to a specified depth (note that only folder objects are returned).

The repository information's call will return information on the navigation service calls that are supported besides the getChildren...

Optional parameters when listing the children of a folder


The getChildren service call allows us to specify a number of optional parameters at request time. To control the number of content items that are being returned, one can use the following parameters in the request URL:

  • maxItems: This is the maximum number of items to return in a response. The default is repository-specific and Alfresco will, for example, return all content items if you do not specify this parameter.

  • skipCount: This is the number of potential results that the repository will skip/page over before returning any results. This defaults to zero.

These paging input parameters work in parallel with the following output parameters in the response:

  • hasMoreItems: This parameter will be true if the repository contains additional items after those contained in the response, otherwise it will be false. If true, a request with a larger skipCount or larger maxItems will return additional results (unless the contents of the repository...

Listing available types and subtypes


When we are working with a repository, it is important to be able to find out what types are available so that we can classify documents and folders properly. One of the first things to do in a CMS project is to design a domain-specific content model so that content can be classified appropriately. A proper content model improves the search capabilities and enables specific behavior to be implemented based on the type of content.

The getTypeChildren service is used for listing types. This service call can also use the paging parameters that the getChildren service call uses, such as maxItems. The type listing will contain a type definition with information about each type. From the type definition, we can determine whether new objects can be created from this type (cmis:creatable), objects of this type are fileable (cmis:fileable) in a folder, you can search for the objects of this type by including the type in the FROM clause (cmis:queryable), and whether...

Getting metadata and content


We now know how to list the contents of a folder. What we would want to do next is to probably download content files and list metadata (that is, properties) for individual content items.

Getting metadata and content with the AtomPub binding

If we take a closer look at the end of the AtomPub service document (that is, the response from http://localhost:8080/alfresco/cmisatom), we will find sections with URI templates; one for getting metadata by ID, which is listed as follows:

<cmisra:uritemplate>
<cmisra:template>
http://localhost:8080/alfresco/cmisatom/f0ebcfb4-ca9f-4991-bda8-9465f4f11527/id?id={id}&filter={filter}&includeAllowableActions={includeAllowableActions}&includeACL={includeACL}&includePolicyIds={includePolicyIds}&includeRelationships={includeRelationships}&renditionFilter={renditionFilter}
</cmisra:template>
<cmisra:type>objectbyid</cmisra:type>
<cmisra:mediatype>application/atom+xml;type=entry...

Creating, updating, and deleting content


After you have listed content (that is, CMIS objects) in the repository, you would probably want to be able to create, update, and delete content. This is handled via the CMIS object services.

The following table gives you an overview of the available object service calls that are related to creating the content of different types:

Service call name

Short description

Long description

createDocument

Creates a document

Creates a document object of the specified type (given by the cmis:objectTypeId property) in the (optionally) specified location.

createDocumentFromSource

Copies a document

Creates a document object as a copy of the given source document in the (optionally) specified location.

createFolder

Creates a folder

Creates a folder object of the specified type in the specified location.

createRelationship

Creates a relationship

Creates a relationship object of the specified type.

createPolicy

Creates a policy

Creates...

Summary


In this chapter, we have gone through most of the basic functionalities that are likely to be used on a day-to-day basis and learned how to use them with both the AtomPub protocol and the Browser binding protocol. We have seen how we can list the contents of a folder and navigate to the subfolders. The Browser binding has shown us that it is quite easy to work with CMIS via this binding as you can use HTML forms for almost all operations and it is easy to integrate with the UI this way.

In this chapter, we also looked into how to download the content types that the repository supports, which is important as you are likely to set custom types when uploading new content. We also covered how to create, read, update, and delete documents and folders for a specific domain. And finally, we went through how to download a document.

In the next chapter, we will look into more features supported by CMIS such as version management, access control, and searching for content.

Left arrow icon Right arrow icon

What you will learn

  • Add, update, delete, and search for content with increasing efficiency using HTTP and XML/JSON, OpenCMIS , JavaScript, and Groovy
  • Feed content directly into a JavaScript widget from a CMIS call JSON response, so you can see how content management servers can be accessed directly via AJAX calls from a web application
  • Integrate Drupal with a content management server via CMIS, so Drupal does not have to store documents and images
  • Integrate multiple content management systems in a standard way via an enterprise service bus and a CMIS connector
  • Handle advanced concepts such as versioning, permissions, and relationships between content items
  • Talk to the Alfresco Cloud service via CMIS, so you can make content available outside the company firewall

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Mar 25, 2014
Length: 272 pages
Edition :
Language : English
ISBN-13 : 9781782163534
Vendor :
Alfresco
Languages :
Concepts :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Mar 25, 2014
Length: 272 pages
Edition :
Language : English
ISBN-13 : 9781782163534
Vendor :
Alfresco
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 101.97
Learning Alfresco Web Scripts
€24.99
Alfresco 4 Enterprise Content Management Implementation
€49.99
Alfresco CMIS
€26.99
Total 101.97 Stars icon

Table of Contents

7 Chapters
Getting Started with CMIS Chevron down icon Chevron up icon
Basic CMIS Operations Chevron down icon Chevron up icon
Advanced CMIS Operations Chevron down icon Chevron up icon
Alfresco and CMIS Chevron down icon Chevron up icon
Accessing a CMIS Server with a Java Client Chevron down icon Chevron up icon
Accessing a CMIS Server Using Scripting Languages Chevron down icon Chevron up icon
System Integration with CMIS Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.8
(6 Ratings)
5 star 83.3%
4 star 16.7%
3 star 0%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Johnny Gee Jun 06, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I have read and reviewed many Alfresco books over the years, but I must say that Martin Bergljung has done a terrific job of making a technical book easy to read. "Alfresco CMIS" is simple and easy to understand. He minimize the amount of technical jargon and if there were some concepts he felt that the reader may not know, he explained them clearly and effortlessly.He does a great job giving the history of CMIS and he does even a better job of describing the various CMIS operations in detail and in plain English. He even talks about how to install CMIS server so that the reader has opportunity to play with CMIS sample code he provides. My only wish is that the author would have talked about the CMIS operations in the context of business problem. The best technical books I have read are the ones that relate technical information to business case.I would recommend this book to anyone who is looking to write a custom app using CMIS against Alfresco repository.
Amazon Verified review Amazon
AHASH Jul 19, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is an excellent resource for anyone wanting to know more about CMIS (Content Management Interoperability Services). It starts out with a good introduction to the CMIS standard including the service, basic and advanced CMIS operations, and the object model. Examples include version management, security, search, and relationship management. The book illustrates various integration patterns via different uses cases. It then goes on to discuss the CMIS implementation in Alfresco (open source content management system).The book discusses various methods for accessing a CMIS server including use of a Java client as well as using using scripting languages such as Groovy. The examples and code snippets provided are very valuable for someone who wants to try out the various examples on their own. A thorough explanation of the code included in the book is also provided.The book concludes with an explanation of how to integrate other systems/applications using CMIS. The examples include integration with Drupal.CMIS is an open standard for integrating content management systems and is gaining popularity. This book provides excellent coverage on the topic with a focus on Alfresco.
Amazon Verified review Amazon
Sam Jun 01, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
As an Enterprise Architect, I work with ECM systems, Documentum, Alfresco, Sharepoint etc. Alfresco is incredibly powerful and has such a low cost comparing to other options, it has enabled me to build full fledged application suite with very short periods of time. Many organizations still have Documentum, but Alfresco can take to many other ECM systems using CMIS protocol. The resulting federated ECM system is a comprehensive solution to document management, collaboration and integration.If you are using Alfresco and need CMIS integration, stop reading the review and just buy it !I have bought >10 Alfresco books that this is among the two books that I would recommend.Enterprise ArchitectSam Wu, SAMSSOFT
Amazon Verified review Amazon
Jorge Jun 03, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is a great book if you need to code an integration with a CMIS server such as Alfresco. Specifically, if you don't want to use a third-party API wrapper, this book will give you the details on how to implement it yourself. Or, if you want to understand what's going on under the hood of your third-party API wrapper.One area where this book could be improved is explaining error cases. For example, if I upload a file to CMIS, what errors should I expect? What if the file already exists? What if my filename is invalid? What other things can go wrong? Without this information, I am left to try all the cases myself to see what happens.
Amazon Verified review Amazon
Romin K. Irani May 14, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The number of solutions being built on top of Content Management Systems is plenty and across implementations, you wish that there was a common API that you could access all the CMS. CMIS is the common API via which you can access any Content Management System that supports this standard.The book starts off with an overview of CMIS and how it came about. The next set of chapters goes into the CMIS Standard, especially the different operations via which you can do create, update, delete and query for documents. These two chapters setup a solid foundation since they allowed you to understand what is happening behind the scenes in terms of the REST Calls and the data formats being exchanged in the request / response.I preferred this approach rather than jumping into a high level API that does not allow the developer to understand some of the details behind the calls. The next chapter jumps into specific support for CMIS via Alfresco.Once this is covered, you get to pick the languages via which you want to access the CMIS API. One chapter covers the Java API in case you are talking to the CMS via a Server side infrastructure or are planning to create your own service layer on top of it. In case you are looking for accessing CMIS via the Web interface, a chapter on invoking the CMIS Interface via JavaScript is also covered.The final couple of chapters delve deeper into integration scenarios with the Drupal Web Content Management (WCM) and Mule ESB Integration.Overall the book is a solid guide to the CMIS Standard via Alfresco. In case you are planning on integrating with any CMIS capable repository, keep this book handy.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.