Mapping Connect REST - receiving PDF file sent in the Body/Payload

Hi,

I’m trying to understand how to map a PDF file sent to the Connect REST in the Body/Payload. My understanding is the file is not encoded, it’s just binary Java Object Type.

Here are some details from the headers of the message:

Content-Type: application/pdf

Transfer-Encoding: chunked

Content-Disposition: attachment; filename=“xxx.pdf”

In Pega I tried this approach:

https://docs-previous.pega.com/data-management-and-integration/87/configuring-rest-connector-receive-binary-attachments

I’m using Java Object property type (BinaryPDF) to map the API response.

Then, I’m using the following Java step in the Activity:

This is partially working because it allows me to send the PDF to the browser:

Unfortunately, the pyResponseAttachmentPage in the Clipboard is empty therefore I cannot use the properties of the page to save the file to the repository and attach it to the Case Type.

Any ideas on how to solve it?
Should I write a custom Java activity step to convert the binary Java Object type to String or Stream?

Thanks!

@jedrb if you have java object with you, please use Code-Pega-PDF. AttachToWork. This OOTB activity will convert it into stream, create an attachment page and attach it to case.

@Anoop Krishna Thx a lot! You saved me a lot of time!