Hello all,
Im sending a post request from my SAPUI5 application to CAP backend and it is uploading file to CMIS repository (SAP Document Management System).
Everything was working normally till now but suddenly deployed version of app to Cloud Foundry is not accepting data as binary.
On local development (BAS) everything is working normally.
Here how I make the call from frontend
oEntry = { "fileBinary": fileBinary, //base64 string "};
$.ajax({ url: sURL,
type: 'POST',
async: false,
processData:false,
contentType: "application/json",
data: JSON.stringify(oEntry),
success: function (response) { ///// some stuff },
error: function (e) { ///// some stuff } });
serviceimpl.js - to upload file to CMIS
let session = new cmis.CmisSession('https://api-sdm-di.cfapps.eu10.hana.ondemand.com/browser');
session.setToken(connJwtToken).loadRepositories() .then(() => session.createDocument(req.data.objectId, req.data.fileBinary, req.data.fileName)) .then(data => console.log(data))
In local development file is being sent and created correctly with following contents
test.txt
test
Once its deployed to CF and request is made, file has following contents
test.txt
dGVzdA==<br>
I feel like deployed version of HTML5 application is transforming/changing the POST call to accept only strings. Any help is appreciated, thank you.
Edit: Just updated the dependency of @sap/cds to newer version. It fixed my issue immediately.
Help others by sharing your knowledge.
AnswerRequest clarification before answering.
| User | Count |
|---|---|
| 10 | |
| 5 | |
| 5 | |
| 5 | |
| 4 | |
| 2 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.