cancel
Showing results for 
Search instead for 
Did you mean: 

Gateway Service with CDS View - POST method

former_member603277
Discoverer
0 Kudos

Hi Experts,

I am facing a problem and i am not sure how could i overcome it.

My objective is to create a Gateway Service that will benefit from the SADL infrastructure and CDS views. The idea is to get the Read with all its “goodies” (filtering, read by key etc) from the CDS View logic and implement manually the Create Update and Delete functions. The scenario prohibits usage of BOPFs.

There are two approaches I tried but non seem to work perfectly.

I created a Gateway Service where the OData Service is Based on a Referenced Data Source (a CDS View).

The problem with this scenario is that even though I implement manually the C U and D methods (in DPC_EXT class), I cannot use the POST. I get the following error in SAP Gateway Client:

“The specified HTTP method is not allowed for the resource identified by the Data Service Request URI”

It's not possible to use POST method when a Gateway Service is created in this way?

I tried one more option in which I create manually the gateway for the CDS View. I created the the associations and then I map the Service Implementation of the main Set ("CustomerSet") to the Data Source (my Consumption CDS View). But when I add the associations in the mapping, I get the following error.

I debugged the framework and i got to an interesting issue. The target entity is not the same the ref entity ( for the associated item).

For example if my CustomerSet is associated with AddressSet, my AddressSet has Target Entity Z_I_Address (interface) and the ref is Z_C_Customer (consumption).

Is there a way to achieve this or will i have to implement even the Read method manually ( create the gate way service full manual).

Thank you,

Alex

Accepted Solutions (1)

Accepted Solutions (1)

Andre_Fischer
Product and Topic Expert
Product and Topic Expert

This error can occur if you try to use the SAP Gateway Client to create a new ressource.

Typically you will use the Gateway Client to read a single Entity (here

/sap/opu/odata/IWBEP/GWSAMPLE_BASIC/SalesOrderSet('0500000000') and use than the button "use as request" so that you get a correct body for your http POST request.

The POST request has however to be executed on the entity set, not the original URL, so you would have to remove the key field(s) that are in the brackets and perform the POST on the following URL:

/sap/opu/odata/IWBEP/GWSAMPLE_BASIC/SalesOrderSet

Regards,

Andre

former_member603277
Discoverer
0 Kudos

Hi Andre. God, i spent so much time working on the Gateway Service thinking there was problem with it or the CDS View ... but the whole issue was with how i made the POST request. Thanks a lot!

Answers (0)