cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Cloud Platform Cloud Foundry Document Management help

johnmurray
Participant
0 Likes
5,485

Hi,

I've started using the Cloud Foundry Document Management (repository and integration options) and I can't work out what I'm doing wrong. Any help at all would be really appreciated.

I've created and onboarded a repository as per the instructions at help.sap.com, and I've also hooked the Reuse UI into my application for testing purposes. When using the API in Postman or my own code, even just trying to create a folder returns me with a "500 Internal Server Error". When using the Reuse UI all of the buttons are disabled so I cannot add anything there either. In the network panel for the Reuse UI I can see it is reaching my endpoint and finding my repository so it's not an error with my app router or destinations.

My main questions are:

  1. Is there any logging available anywhere to help with the unhelpful 500 Internal server error messages?
  2. Are there any guides anywhere that contain working examples of code and not just snippets?
  3. What should the "objectId" be for the Reuse UI if I'm just working at the root level?

Thanks

John

Accepted Solutions (1)

Accepted Solutions (1)

johnmurray
Participant
0 Likes

After using the correct object Id (see the comments above) the buttons in the Reuse UI unlocked. However when trying to add a folder I get an "You must buy additional entitlements to continue with your action. You have exceeded your storage limit." error, which does not make sense for multiple reasons. I'll raise an OSS message.

Answers (3)

Answers (3)

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert

Hi jmurray91

I usually use CMIS Workbench to troubleshoot CMIS API calls. It also makes your life easier when dealing with the payload you need to send via CMIS protocol. You can download it via the following URL:

https://chemistry.apache.org/java/download.html

Once you have it up and running, connect to the browser service like this:

Click on the Expert tab and past the bearer token like so:

Click on the load Repositories, select the one you want to work on and click on the login button.

You should see a window like this:

Here you can use Groovy Script to test the code you want to use on your CMIS Client Application.

Officially, Apache open CMIS project supports a JQuery JavaScript library:

https://chemistry.apache.org/javascript/parts.html

However, I was able to use the cmis NodeJs Object with the following code:

const express = require('express')
const app = express()
const port = 3000

var cmis = require('cmis');
const { json } = require('express');

app.get('/', (req, res) => {

  var session = new cmis.CmisSession('https://api-sdm-di.cfapps.eu10.hana.ondemand.com/browser');
  session.setToken('eyJhbGci........................................................71YjfA')
    .loadRepositories().then(function(){
        return session.query('SELECT cmis:objectId, cmis:name, cmis:contentStreamLength FROM cmis:document');
  }).then(function(data) {
      console.log(data);
      res.send(data);
  });
})

app.listen(port, () => {
  console.log(`Example app listening at http://localhost:${port}`)
})

This is the result set I get when I run this application:

Which is pretty much the same as I get on the CMIS Workbench:

Best regards,
Ivan

johnmurray
Participant
0 Likes

That's brilliant, thank you for responding. Very useful information! I did eventually manage to get my Reuse UI to work, but then got an error about my quotas (but I have unlimited quota) so I have raised an OSS message.

The workbench looks extremely useful so thank you for letting me know about that. It's also great that you've found the cmis nodejs library to work as that's the one I'm attempting to use.

Thanks

John

0 Likes
ivan.mirisola are you using this nodeJs app as a destination in CF and accessing it by another sap Fiori App?

Do you have another method implemented in nodeJs for uploading a file in that repository?

Thanks in advance.
Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi pcostantini_bbt,

I didn't test this JS library on CF at all. But you may find createDocument method available at:

https://svn.apache.org/repos/asf/chemistry/parts/trunk/cmis-js/lib/cmis.js

And same samples using it at:

https://svn.apache.org/repos/asf/chemistry/parts/trunk/cmis-js/components/library/template.html

Best regards,
Ivan

0 Likes

ivan.mirisola how do you get the content of the documents?

0 Likes

ivan.mirisola , jmurray91, how do you get the content of the documents by using JavaScript?

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert

Hi pcostantini_bbt,

What are you trying to do exactly? SAP provides documentation on how to create a proxy bridge service in Neo so you can implement the call to the CMIS repository via Web Service (browse). In that sense, one could develop an HTML5 front-end application that performs the calls to this API via a destination without any Java or NodeJS development at all. The service allows you to perform all of the HTTP methods like PUT, DELETE, GET on the connected repository. All you need to do is to make the necessary calls to the API to do this:

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

Once you get the proxy bridge going, your deployed application will implement the following endpoints to interact with your repository:

AtomPub: https://<cmis_proxy_bridge+account_ID>.hana.ondemand.com/cmisproxy/cmis/1.1/atom
Browser: https://<cmis_proxy_bridge+account_ID>.hana.ondemand.com/cmisproxy/cmis/json

On the other hand, openCMIS provides other client libraries that allows you to code whatever you want with your repository - usually in Java, but there are other languages supported as well.

However, on the majority of use cases, the proxy bridge will do most of the common tasks.

If plan on coding everything from scratch using a client library and you have any doubts on how to do any interaction with your CMIS repo, please install the Workbench as I mentioned above. You can check the console and fiddle with its scripts menu to find out how to interact with your file/folders/metadata/etc. The same is valid for repository calls made by HTTP - just look at the trace

You could use this open source project that implements a swagger api documentation so you can test the REST API against your repository:

https://github.com/PogeyanOSS/cmis-swagger

Best regards,
Ivan

former_member210955
Active Participant

Hi Pablo,

If you are using CmisJS then you can use getContentStream [1] to get the content .

If you are not using CmisJS then you have to form the HTTP request yourself and get the content by calling the API[2]

I have written a sample JS[3] on how to connect to SDM using CmisJS and execute the APIs.

Java Examples are here[4], you can similarly follow for JS

Best Regards,

Saurav

[1] https://agea.github.io/CmisJS/classes/cmis.cmissession.html#getcontentstream

[2] http://docs.oasis-open.org/cmis/CMIS/v1.1/errata01/os/CMIS-v1.1-errata01-os-complete.html#x1-2650001...

[3] https://gist.github.com/saurav28/3f8e073946d7f3482ce1258264ec717c

[4] https://chemistry.apache.org/docs/cmis-samples/samples/content/index.html#getting-content

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi jmurray91,

The admin url will only allow you to create a new repository when you have assigned the proper roles to a role collection that is assigned to your user. The same applies to the web url.

To add the proper roles to your user, please follow the on-boarding instructions:

https://help.sap.com/viewer/f6e70dd4bffa4b65965b43feed4c9429/Cloud/en-US/66e4071b01be4c02bb3733afb0f...

To be able to consume the document repository, you must create another service via CF Marketplace - Document Management, integration option (sdm). Once created, you then need to create a service key to get the JWT token credentials for the service:

https://help.sap.com/viewer/f6e70dd4bffa4b65965b43feed4c9429/Cloud/en-US/bff9fd6addce47f3975442a7689...

With that token, you can now call the rest api to interact with your repository via postman.

https://help.sap.com/viewer/f6e70dd4bffa4b65965b43feed4c9429/Cloud/en-US/d30200e0993a457888db2786d4b...

I suspect you have not added the proper authorizations to your user - hence you have no buttons available on the admin interface. Also, you don't have authorization to create documents, etc.

Once you have all in place, than you can call the rest API end-point /rest/v2/:

https://help.sap.com/viewer/f6e70dd4bffa4b65965b43feed4c9429/Cloud/en-US/9143a10ccf264196b23b329c939...

Once you get the ECM ID for your repository, you can simply call the sdm url using a compatible CMIS library on your client:

https://help.sap.com/viewer/f6e70dd4bffa4b65965b43feed4c9429/Cloud/en-US/5d4b802267d14df2ab3b64b3049...

Hope this helps!

Best regards,
Ivan

johnmurray
Participant
0 Likes

Hi Ivan,

Thanks for you answer. However, I can confirm that I have already created a repository using the API in Postman and also that there is no issues with my roles (I have granted myself all of the possible roles for DM), and that part was actually quite straight forward using the help documentation.

My problem occurs when I try to use a CMIS library to access or do anything with my repository, beyond the simple /browser query. I'm trying to use https://www.npmjs.com/package/cmis if that makes any difference? I'm wondering perhaps if that isn't compatible? Ideally I would like to use a Javascript library as that's what the rest of the code is written in. Unfortunately the errors I'm receiving are unhelpful generic error messages so it's quite hard to work out what I'm doing wrong.

Kind regards

John

johnmurray
Participant
0 Likes

I found the correct root folder Id to use this morning, so now the buttons do actually unlock which is great. However it unfortunately still doesn't work when I try and add something, because I get the error: "You must buy additional entitlements to continue with your action. You have exceeded your storage limit.". This doesn't make any sense because I am the global account admin and we're using the cloud credits model so have "unlimited" quota, and it is correctly assigned to the sub-account. I'll raise an OSS message.

AbhijeetK
Active Participant
0 Likes

Hi Ivan,

we are using both Neo(Because few apps are complex and not able to migrate to CF) and CF. In Cloud foundry I am able to configure DMS app, but we want the same app in neo portal service as well. I am not sure how to achieve this as, in neo there is no DMS service, but some other document service is available.

Is there is any way that we can integrate this CF DMS app to NEO portal service(Embed this app into Neo portal) ?

or Create a web content widget to publish DMS contents by calling API's(Which you listed above) from CF in neo ?

And is it possible that all those access control will work on user for visibility of document/Folder(In neo portal service ) ?

your comments suggestions are highly appreciated.

Regards,

Abhijeet Kankani