[SOLVED] Send Binary File to REST Service (using IF_HTTP_CLIENT)

Hi everyone!

I need to send a binary file (PDF) to a REST service.

First of all, before develop something in ABAP, I tried the service using Postman.
I have noticed that I can send the files in two ways:

  1. As a form-data:
    https://i.postimg.cc/Y9K4v8Lc/1st-way.png

  2. As a binary:
    https://i.postimg.cc/85R7MWL7/2nd-way.png

I have replicated the first way (as a form-data) with the following code:
https://i.postimg.cc/FR5qp915/Abap-Code1.png

But I could not replicate in ABAP the second way (as a binary) and the REST service work different if I send the file in those ways (as a binary, the service works fine).

Have someone faced this issue?

Thanks in advance!

Scroll to Top