openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

OData response to update call in $batch problematic in version 1.38?

Open ssimsekler opened this issue 10 years ago • 8 comments

OpenUI5 version: 1.38.7

Browser/version (+device/version): Chrome 52.0.2743.116 m

Any other tested browsers/devices(OK/FAIL): IE 11 - FAIL

Steps to reproduce the problem:

The app uses OData model (v2), i.e. say oODataModel, and the OData model is configured to use batch.

  1. User modifies a simple data for an entity. By this, oODataModel adds a change set containing a MERGE request to the to-be-called $batch request. Additionally, further GET requests are added to the same $batch request.
  2. User hits Save which calls oODataModel.submitChanges() and the $batch request is sent to the backend SAP system.
  3. Application reads the oData parameter of the event batchRequestCompleted and based on the elements of the requests array, checks the response field of each array element to decide whether the relevant operation was successful or not.

What is the expected result? E.g. in v1.28: The update operation response is marked as "success=true", the HTTP response code is "204 - No content"

What happens instead? In v1.38: The update operation response is marked as "success=false", the HTTP response code says "0 - abort"

Any other information? (attach screenshot if possible)

  • In both cases, data is updated successfully at the backend system
  • For update operations, SAP Gateway seems to always send "204 - No content"
  • Making the update operation use PUT instead of MERGE does not change the result

scn_odata_update_problem_03

ssimsekler avatar Aug 25 '16 14:08 ssimsekler

Thanks for reporting this. The only thing I now is that there has been some optimization regarding aborting duplicate requests. But from your description it's quite hard to guess / reproduce the actual issue. In order to analyze this issue from our side we would need some running code example that allows us to reproduce this. I know that this might be difficult as you most probably can't expose your backend service. You might try to reproduce this with our MockServer (if possible) or build some demo OData Service that can be run with e.g. Node.js or Java.

matz3 avatar Aug 26 '16 08:08 matz3

Hi ssimsekler, requests could be aborted. In this case it looks exactly like in your screenshot. Aborted requests will not be sent to the backend. How did you modify the data? Via "TwoWay" binding or manual update requests? BR, Jan

loginger avatar Aug 26 '16 09:08 loginger

Hi Matthias/Jan

Thanks for your responses. The oData model is set to use Two-Way Binding. The request is received in the backend system and is processed properly by applying the update and sending "204 - No Content" as the response.

I would think the scenario is easy to reproduce. Change an entity where the OData model (v2) uses batch and two-way binding, submitChanges(), and observe the event parameter for batchRequestCompleted.

This looks like a very common scenario but I thought this was a bug candidate because it works in v1.28 and not in v1.38.

Kind Regards

Serdar

ssimsekler avatar Aug 26 '16 10:08 ssimsekler

Hi guys

I created a plunk to demonstrate the problem:

OpenUI5 OData Update with Mockserver

I inserted break-points at places where you can check the points I mentioned above.

Hope this helps.

Kind Regards

Serdar

ssimsekler avatar Sep 14 '16 22:09 ssimsekler

Hi,

Thanks for providing the sample. we track this internally now 1670423847.

best regards, Tobias

ghost avatar Sep 19 '16 07:09 ghost

Hi, the issue only occurs on 1.38.x. I fixed it with 44f228f23c4988f96d9bdbf2b8e3848edaf9582d. BR, Jan

loginger avatar Oct 05 '16 12:10 loginger

Hi Jan

Thanks for the fix. Can I ask which SAP Note we need to apply to get the fix?

Kind Regards

Serdar

ssimsekler avatar Oct 05 '16 13:10 ssimsekler

Hi, it will be included in the next 1.38 patch. Patch not yet build. So I can't give you more info so far. BR, Jan

loginger avatar Oct 06 '16 15:10 loginger