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:
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!
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
I don't think you need to change the auth-method, at least I did not. Have you followed all the steps in the docu? https://help.sap.com/viewer/b0cc1109d03c4dc299c215871eed8c42/Cloud/en-US/ed1c6732d4214c68846ab9813b9df943.html
If you take the url from the java app and add /cmis/json ,you should see the following:
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
looks the same as mine... are you using the correct repository name and key?
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.
Hi Lemaire,
I used the SAP help to create Proxybridge, deployed it in SCP but when i use the url with URL/cmis/json i get 404 not found error..
i created the dynamic web application in Eclipse Oxygen, with cloud SDK Java Web Tomcat 8: neo-java-web-sdk-3.93.5.zip and deployed in SCp with same run time (tomcat 8)
i guess i am missing something and getting the error. do you have any idea what could be wrong?
Can you please share the Java proxy bridge project?
Here you have my java proxy project: https://github.com/lemaiwo/NEODocumentServiceProxy
Hi Wouter,
First thing First. It is an amazing blog. Enjoyed it and trying to do exactly what you did here.
Now my problem 🙂
I'm getting the repo ID from this no problem there.
But when I run the app I get this error at loadFiles() seems because of the bad call or something can you please look and maybe point me in the right direction?
This may not be enough information but I thought I'd ask you to see if you can help with this. after scraching my head for a while 🙂
Are you able to access your proxy directly? If so, maybe something wrong with your destination? Otherwise, first try to fix the proxy.
Kr, Wouter
Yes, it was my destination. Thanks for the pointer.
Laeeq Siddique
it was surely my destination. Working fine now.