cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PI - REST Receiver PDF Content application/octet-stream

YouriC
Participant
0 Kudos

Hi all,

I'm working on a SAP PI interface (synchronous) :
[ABAP Proxy] >>> [SAP PI 7.5] >>> [REST API (REST Adapter)]

I consume a REST API to retrieve a PDF file.
Receiver URL is something like this : https://my-url-api/api/v1/document/{key}/content

The request process is fine, no problem with this part.

The API response is directly the content of the PDF file (application/octet-stream)

2024-03-23_17h55_04.png

Currently I can't retrieve the PDF into my backend ABAP System (ABAP Proxy). 

On my REST communication channel settings I use (Data Format Response):
Data Format : "Binary"
Assign binary message as : "Main Payload of XI Message"
If I use "Attachment to XI Message (No main Payload)", I'm encountering an error like "Logging message failed, due to Failed to log msg" and nothing relevant on PI logs ...

With JSon or XML for Response Data Format It's always the same error : Response does not have the expected format.

With "Main Payload of XI Message", I have this error "Content is not allowed in prolog" or "Content is not allowed in trailing section". 

I also tried without operation mapping on my ICO : In this case no error on SAP PI, and on SXMB_MONI It's also OK, but an error occur on ABAP Code : Error during XML => ABAP conversion: Response Message.
On SXMB_MONI I can open the PDF file via double-click on the Payload.
So I think this is the right way to go... but not sure > How to retrieve correctly the PDF on my ABAP code ?

2024-03-23_18h22_14.png

I also tried some tricks with Error Handling and {http_result}, but always the same problem, PDF content is not allowed on XML tag.

Using Support Attachments on my Communication Channel doesn't change nothing.

If anyone has a solution, I'd love to hear it.

Regards,
Youri

Accepted Solutions (1)

Accepted Solutions (1)

YouriC
Participant
0 Kudos

Solved: I used a JAVA Mapping to map the PDF content to an Attachment.
The Attachment is available on the Service Interface (Backend ABAP Proxy).

Answers (0)