Skip to Content
Technical Articles

Document Repository Viewer

Problem

In the Face Recognition App, I used the Document Repository service to save the images of persons. One of the things I noticed about this service, it has no out-of-the-box application to view your documents. In my opinion, this is an important missing feature. Especially, when you’re doing some tests… You never know for sure if your upload was successful. If you upload something, you need to validate the result in the document repository. Also, when you upload a wrong image and want to delete it, you first need to implement the delete function in your app… Besides that, there are many other situations that you want to view the documents that you have uploaded in the Document Repository.

(More information about the Face Recognition app: https://blogs.sap.com/2019/05/28/face-recognition-app/ )

Solution

For this reason, I created a very simple app to view, upload and delete documents in the SAP Cloud Platform Document Service. Images will show a preview, other documents can be opened via a link.

 

Installation

Activate the Document Repository Service

Activate the Document Service in you SCP account:

Go to Services and search for Document Service. This should be enabled by default, otherwise you need to enable it yourself.

Once it’s active (normally this is active by default), you’ll can open it directly from “Document Repositories”:

Create a repository:

And fill in all the details. Note down the Repository Key, you’ll need it later:

Install your proxy

Build a Proxy Bridge like explained in SAP Help:

https://help.sap.com/viewer/b0cc1109d03c4dc299c215871eed8c42/Cloud/en-US/ed1c6732d4214c68846ab9813b9df943.html

Deploy this Proxy Bridge on your SCP account by using the Eclipse tools or directly in the SCP Cockpit:

Destination

Create a destination to access the proxy bridge in the UI5 app in SCP and SAP Web IDE.

Name=documentservicewl
URL=https://cmisproxysaps0007914286trial.hanatrial.ondemand.com
ProxyType=Internet
Type=HTTP
Authentication=BasicAuthentication
Description=Connection to Proxy Bridge App Wouter Lemaire
User=wouter.lemaire@flexso.com
Password=xxxx

 

UI5 App

Get the app from the following GitHub Repository, you can clone it in SAP Web IDE or locally: https://github.com/lemaiwo/DocumentRepositoryViewer

Test it in the SAP Web IDE or deploy it on SCP!

Hope this will make it easier to use the SCP Document Repository service for you!

8 Comments
You must be Logged on to comment or reply to a post.
  • I have followed this tutorial but when I tried to put a destination for proxy server deployed in JAVA application in SCP and then I checked the connection, it returns a “Not Found Message”. What should be the credentials for my destination?

    • The credentials of your SCP account.  You could test it by navigating to the proxy in a new session and fill in your credentials.

      Also not sure if you should worry about the message…Maybe you can ignore it and try the app..

       

      Kr, Wouter

    • Yes I have followed it. I guess my issue here is the configuration in web.xml. I have tried to deploy a simple “Hello World” and it works. But the moment I add the servlet configuration in web.xml, it is now “Not Found”. Do you think my configuration is correct as per the screenshot I sent? What should be the value of <web-resource-name>? Is my path of my servlet correct?

      • Hi,

        I just removed these block of codes and it worked. I’m not sure why the code is not working with it but in the document, it is included.

         

        <security-constraint>
        <web-resource-collection>
        <web-resource-name>Proxy</web-resource-name>
        <url-pattern>/cmis/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
        <role-name>EcmDeveloper</role-name>
        </auth-constraint>
        </security-constraint>
        <login-config>
        <auth-method>BASIC</auth-method>
        </login-config>

         

        By the way, thank you very much for this post. 🙂

        • This is my web.xml

          <?xml version="1.0" encoding="UTF-8"?>
          <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
            <display-name>cmisproxysap</display-name>
          
          <servlet>
            <servlet-name>cmisproxy</servlet-name>
            <servlet-class>be.wl.CMISProxyServlet</servlet-class> 
          </servlet> 
          
          <servlet-mapping>
            <servlet-name>cmisproxy</servlet-name>
            <url-pattern>/cmis/*</url-pattern> 
          </servlet-mapping>
          
          <security-constraint>
            <web-resource-collection>
              <web-resource-name>Proxy</web-resource-name>
              <url-pattern>/cmis/*</url-pattern>
            </web-resource-collection>
            <auth-constraint>
              <role-name>EcmDeveloper</role-name>
            </auth-constraint>
          
          </security-constraint>
          <login-config>
          	<auth-method>BASIC</auth-method>
          </login-config>
          
          </web-app>
  • Hi,

    Yes I’m sure I am using the right name and key. I’m note sure but it is not working having those <security-constraint> and <login-config> tags in my web.xml. But even without those codes, my repository is still protected and it is working fine in my UI5 application.