1
votes

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."}}}

1
No need to delete this question. It may very well be of interest for future visitors. Pls add the verbatim error message to the question. There is some suspect, but I can only verify from the error message...flaschbier
@flaschbier I have added exactly the same error code you asked for. Please helpkuljit k
see answer below. Awfully sorry that I have no better news for you.flaschbier
Yaa got it. Thanks for the replykuljit k

1 Answers

1
votes

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 PUTonce.

So we can conclude that, funnily, the UI5 docs advertise a method which is not supported by the XS server.