Skip to Content
Technical Articles

Connecting to your Document Service Repository (neo)

Overview & required tools

The SAP Document Service is a kind of obscure service in SAP Cloud Platform – Neo (at least to me when I started using it a long time ago). I’ve seen some questions related to it on this Community and decided to write this blog to let everyone know a key tip I’ve learned from working with it.

The reason why I initially thought Document Service was obscure was that I didn’t knew how to view it as a database. You create an instance of the repository and if you take a look at SAP’s documentation all you get is information about the bridge proxy and how to consume the service using the SDK or REST and JSON web interfaces.

However, this doesn’t give you the whole picture of what you get from each repository instance. It would be really great and helpful if you could actually “see” the repository.  It turns out you can.

All you need to do is create and deploy your own proxy-bridge onto your neo sub-account.

Once you have it in place, add the required roles to your user – if you have added the EcmDeveloper role into your web.xml file – as it is stated in the SAP documentation. This will give your Neo’s user ID access to the Proxy Bridge. Thus, this is the user you will be using to access the repository.

Download the openCMIS Workbench and install it on your machine.

Open the cmis proxy application in Neo’s Cockpit and copy its URL.

Once installed, open the application. It will open the login screen.

At the login screen, use the basic tab and paste the cmis proxy url you copied adding the following suffix:

/cmis/json

REST to the rescue

This is a REST web service that is compatible with the Workbench and the specification for it can be found here. You could even use this REST interface to consume the services directly via an HTML5 application.

Select browser as binding mode and enter your user id and password (the same you used to add the role EcmDeveloper. All other fields can be left as standard settings.

Your login screen should look like:

Click on the Load Repositories and then click on the Login button that should get enabled.

Voila!

So much you can do in a CMIS Repository

Once you hit login, you should be able to see all the information from your repository instance in the Workbench. You can also perform all of the basic CRUD document operations as well as create document types, etc.

Creating documents on the repository is very simple:

Checking attributes and other information about a particular document:

Aside from that you can also add new document types with additional attributes, extending a basic cmis:document type. Simply export the cmis:document type, erase all attributes (keep just one as a template so you can modify it) and add the parentID as cmis:document. Once you have all in place, just click on Create Type, and select your modified JSON file similar to mine:

{
    "id": "Test",
	"parentId": "cmis:document",
    "localName": "Test Document",
    "localNamespace": "com.sap.ecm",
    "displayName": "Test Document",
    "queryName": "cmis:test",
    "description": "Test Document Base Type",
    "baseId": "cmis:document",
    "creatable": true,
    "fileable": true,
    "queryable": true,
    "fulltextIndexed": false,
    "includedInSupertypeQuery": false,
    "controllablePolicy": false,
    "controllableACL": true,
    "typeMutability": {
        "create": true,
        "update": false,
        "delete": false
    },
    "versionable": false,
    "contentStreamAllowed": "allowed",
    "propertyDefinitions": {
        "test:externalId": {
            "maxLength": 13,
            "id": "test:externalId",
            "localName": "test:externalId",
            "localNamespace": "com.sap.ecm",
            "displayName": "test:externalId",
            "queryName": "test:externalId",
            "description": "test:externalId",
            "propertyType": "string",
            "cardinality": "single",
            "updatability": "readwrite",
            "inherited": false,
            "required": true,
            "queryable": true,
            "orderable": true,
            "openChoice": true
        }		
    }
}

Now you are able to load the type definition from a JSON file and this will create the following type under the basic cmis:document type:

Now you are able to create a new document based on the new type to store that new attribute:

You can even run Groovy Scripts inside it to check a Java Logic before implementing it:

It is really very useful.

Enjoy!

Ivan

 

Be the first to leave a comment
You must be Logged on to comment or reply to a post.