cancel
Showing results for 
Search instead for 
Did you mean: 

entity can post but put (405)

Former Member
0 Kudos

Hello,

I have a simple demo situation with:

  • Hana trial db
  • a table with 3 keys and other fields
  • odata service created by wizard tool in online editor tool

my files are:

xsodata:

service{
    "DB"."CA01" as "Ca01";
   ...
}

xsaccess:

{
    "exposed": true,
    "authentication": [{
        "method": "Form"
    }],

    "mime_mapping": [{
        "extension": "jpg",
        "mimetype": "image/jpeg"
    }],
    "force_ssl": false,
    "enable_etags": true,
    "prevent_xsrf": true,
    "anonymous_connection": null,
    "cors": [{
        "enabled": false
    }],
    "cache_control": "no-cache, no-store",
    "default_file": "index.html"
}

I use an odata model with sapui5 for action on the package.

When I read (GET) it's ok, when I create (POST) it's ok (the data are written succesfully), when I update (PUT) I have the answer:

{ "error": { "code": "", "message": { "lang": "en-US", "value": "The URI is not valid for PUT operation. The URI must point to a single resource for PUT operations."}}}

with a status code:

405 Method Not Allowed

With create or update I'm using the same js obj:

var saveObj = {
    KEY1: 1,
    KEY2: 1,
    KEY3: 1,
    VALUE1: 'something',
    ...
}

the odata create call is:

odataServ.create('Ca01', saveObj, null, function (odata, resp) {
    console.log(odata);
    console.log(resp);
   });

the odata update call is:

odataServ.update('Ca01', saveObj, null, function (odata, resp) {
    console.log(odata);
    console.log(resp);
   });

As you can see the only difference is the method.

obviusly I try to update after the create is done, the row appear in the table, the keys are populated, the sapui5 app is reloaded and other basic test.


If somebody can help me I will really appreciade

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello,

Your answer is right, if I read the __metadata url is written in this way. My mistake.

The answer from the server is:

500 Internal Server Error
{ "error": { "code": "", "message": { "lang": "en-US", "value": "Service exception: [7] feature not supported"}}}

That is a better answer but not the solution 😞

How can I activate this feature in hana xsodata service?

Anyway, thank you for your answer!

jamie_cawley
Advisor
Advisor
0 Kudos

I do not understand what you are asking. You have to supply a path with the id to update a value, otherwise the system would never know what you are calling put against.

Regards,

Jamie

jamie_cawley
Advisor
Advisor
0 Kudos

The error is saying that you can not call method put to Ca01 which represents multiple entities. You must set the path to a specific entity.

odataServ.update('Ca01(THE ID)', saveObj,null,function(odata, resp){
    console.log(odata);
    console.log(resp);});

Regards,

Jamie