cancel
Showing results for 
Search instead for 
Did you mean: 

oData CRUD operation HANA DB MDC on SCP

e_giunta
Participant
0 Kudos
353

Hi I have created successfully (with SAP HANA Web-Based Development Workbench) a table in "Catalog" and then I'have created a package on "Editor" where I have configured a xsodata file to define the service. I test it and works the GET method but not POST one. The only place where the crud methods are defined is in xsaccess file and both methods are defined there ("cors": { "enabled":true, "allowMethods": ["GET","POST","DELETE","PUT"],). So I dont find the error. Do anyone know a step by step tutorial to implement CRUD operation with oData Service with

SAP HANA Web-Based Development Workbench on SAP Coud Platfom.

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

pfefferf
Active Contributor
0 Kudos

It would be great if you could add the error message you get to your question. I assume, you simply did not set the x-csrf-token header.

e_giunta
Participant
0 Kudos

Thanks for your answer.

I get 403 forbidden error. I test POST method as follow (with postman):

- run GET method for individual entity by ID (https://dbs00*******83trial.hanatrial.ondemand.com/test/service.xsodata/Documents(DOCUMENT_NUMBER='1000000001',SAP_SD_DOCUMENT_NUMBER='1000000001')),

- copy/paste the response in request body of POST method changing the ID value with new value and run the request (https://dbs00*******83trial.hanatrial.ondemand.com/test/service.xsodata/Documents).

Here the complete xsaccess file:

{ "exposed" : true, "authentication" : { "method": "Form" }, "cache_control" : "must-revalidate", "cors": { "enabled":true, "allowMethods": ["GET","POST","HEAD","OPTIONS"], "allowOrigin": ["*"], "maxAge":"3600" }, "enable_etags" : false, "force_ssl" : false, "prevent_xsrf" : true }

pfefferf
Active Contributor
0 Kudos

Again the hint. Did you set a X-CSRF-Token header in your post request?

e_giunta
Participant
0 Kudos

Thank you Florian!

I solved adding X-CSRF-Token in header (I get the value from the previous GET request) and set content-type to application/atom+xml (previously i set to application/xml) and now it works.