Skip to content

OData V4 Edm.Binary Deserialization Fails for Base64URL Payloads returned by odatav4 api #1100

@AlexDiwong

Description

@AlexDiwong

Describe the Bug

The api to get the binary data for a purchase order returns the data in the OutputBinaryData property as Base64Url encoded, but the sdk expects base64 encoded which fails the deserialization.

Api used:
odata4/sap/api_purchaseorder_2/srvd_a2x/sap/purchaseorder/0001/PurchaseOrder/:id/SAP__self.GetOutputBinaryData()

AI summary of the problem:
odata-v4-core binary deserialization rejects valid Base64URL values for Edm.Binary.

In ODataGenericConverter ODataGenericConverter.java, binary decoding uses Base64.getDecoder() only. If an OData V4 service returns URL-safe Base64 (- and _) in an Edm.Binary field, typed deserialization fails and logs Not deserializable.

This Breaks typed deserialization for services returning Base64URL-encoded binary (for example, S/4HANA GetOutputBinaryData response field OutputBinaryData).

Steps to Reproduce

  1. Compile a purchase order service
  2. Use the service to GetOutputBinaryData()
  3. See deserialisation error when trying to deserialize the response to D_PurOrdGetOutputBinaryDataR.

Expected Behavior

Either the API should conform to returning base64 encoded binaries (which probably would be tricky to roll out), or the sdk needs to correctly treat the OutputBinaryData property to be Base64Url-encoded.

Used Versions

  • Java and Maven version via mvn --version: ...
  • SAP Cloud SDK version: 5.26.0
  • Spring Boot or CAP version: ...

Impact

Inconvenience, We implemented a work around where we get the response raw and manually decode the property.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions