sapmentors / cap-community

SAP CAP Community
MIT License
97 stars 26 forks source link

OData V2 Proxy - Service Document should be XML but is JSON #82

Closed ChrisDev88 closed 4 years ago

ChrisDev88 commented 4 years ago

The default format for Odata V2 is XML and not JSON. The V2 Proxy is rendering the Service document in JSON only. This should be only the case if the "accept" header is set to application/json.

Because of this it is not possible to create an Offline Store in Mobile Services. The open offline store method of Mobile Services tries to read the Service Document as XML and fails with the error: Retrieve service document failed because the OData server returned HTTP code, 406, with OData error message: Code: NOT_ACCEPTABLE, Message: The content-type range 'application/atomsvc+xml,application/xml' is not supported as value of the Accept header.

You can reproduce it with a simple call against the Service document with accept header application/xml:

grafik

ChrisDev88 commented 4 years ago

I created the incident 341925 / 2020 in SAP Launchpad.

gregorwolf commented 4 years ago

Guess this https://github.com/gregorwolf/SAP-NPM-API-collection/commit/b6cc89fc633caee196ab4c111d89d6e06a299492#diff-827dcecad361905eadb3855633c1eea4R14 is the fix for your issue.

ChrisDev88 commented 4 years ago

yeah nice :) I just saw the update on my incident. I will try it out this weekend and let you know if it is working as expected.

ChrisDev88 commented 4 years ago

The above commit is working fine :) .