cancel
Showing results for 
Search instead for 
Did you mean: 

Can I get HTTP OK (200) from Gateway after PUT instead of HTTP No Content (204)?

Former Member
0 Kudos

Hi everyone!

We created a backend service in an SAP Transportation Management system which is exposed by the SAP NetWeaver Gateway through the OData channel and consumed by custom mobile apps (Android and iOS). We pretty much have everything worked out, but are missing a final piece to make it a really good solution.

When we send a PUT request to trigger an update on an entity, we receive a "204 No Content" http response to signal a successful operation. Browsing through all kinds of SAP documents about SAP NW Gateway I found that this seems to be the standard response. However, the HTTP 1.1 standard also allows for a "200 OK" response including a message body after a successful PUT request (http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html). This would allow us to send back the modified entity in the response, but we cannot figure out what to do in the backend service to trigger this kind of response.

So, my question really is whether anyone knows whether this is even possible in SAP NW Gateway or maybe even knows how to do it.

As an alternative, I'd like to find out whether there is a way to trigger other responses like "409 Conflict" from the backend service to indicate that the operation was not successful. The final goal of this enquiry is to find a way to handle race conditions. When two users on two mobile devices try to update the same entity at the same time (which can only be done once), the "looser" needs to know about it and receive the updated data.

Any input on this is greatly appreciated!

Thanks,

Sebastian

Accepted Solutions (0)

Answers (2)

Answers (2)

naotoxxx
Participant
0 Kudos

This is happend to my but with the update method, my solution was to send the response in the header , like this:

on my service:
DATA: lo_clase_retun TYPE REF TO /iwbep/if_message_container.
   lo_clase_retun = mo_context->get_message_container( ).
   lo_clase_retun->add_messages_from_bapi( it_bapi_messages = lt_return (my response ok or not)
                                iv_add_to_response_header = abap_true ).

on a sapui5 app : (after send my request and read the response)
var respuesta = JSON.parse(event.mParameters.response.headers['sap-message']);

so in my app i read if my response is 204 (ok)

Former Member
0 Kudos

Hi Sebastian,

Did you find a solution for having a success message for a PUT request?

Thanks & Regards

Neha