Reputation: 291
I am using SAP HANA xsodata service to create an ODATA service on a HANA table, which is working fine.
Updating the model with update parameter on sap.ui.model.odata.ODataModel works fine
Code:
oModel.update(sUrl, oEntry, {
success : //do something ,
error : //do something
});
Now I want to use MERGE in place of PUT while Updating, following the documentation
My code:
oModel.update(sUrl, oEntry, {
merge: true,
success : //do something ,
error : //do something
});
It's throwing an error as only Get, Post, Put and Delete is supported.
So, my question is, whether XSODATA service doesn't support MERGE?
If it supports MERGE, what is wrong with my code?
Error - The following problem occurred: HTTP request failed405,Method Not Allowed,{ "error": { "code": "", "message": { "lang": "en-US", "value": "Invalid HTTP method. Only GET, POST, PUT, DEL methods are allowed."}}}
Upvotes: 1
Views: 1536
Reputation: 4177
It very much looks like the XS server only supports the following HTTP methods: GET
, HEAD
, POST
, OPTIONS
, PUT
, DELETE
, TRACE
, CONNECT
. To see this, visit
https://<your.server:port>/sap/hana/xs/admin/#/package/<your.package.in.dot.notation>
Navigate to the package that contains your ODATA service .xsodata
file, not drill into but click the name, chose tab "CORS" and go [Edit]. Down the page you see what methods can be allowed.
The docs, all docs, are a bit vague, but this is the list.
The default settings say GET
, HEAD
, POST
, OPTIONS
are allowed, which fits your error message. The settings in that tab are obeyed, as I had to learn the hard way when I tried a PUT
once.
So we can conclude that, funnily, the UI5 docs advertise a method which is not supported by the XS server.
Upvotes: 2