PeopleTools and Lifecycle Management - PSFT (MOSC)

MOSC Banner

Sending attachment data via REST service

Siva_PS
Siva_PS Posts: 2 Blue Ribbon
edited Oct 6, 2022 10:16PM in PeopleTools and Lifecycle Management - PSFT (MOSC) 2 commentsAnswered

Hello - I am trying to send a PDF in a REST service response to an external system but unable to do so. I get the error message

"Invalid parameter passed for method: SetValue of Document Primitive: file_data. (2,1016)"

FYI, I have created a document based message with file_data as one of the fields as shown in the screenshot below

image.png

the assignment is done via this line of code

 &ComResp_Level1_Item.GetPropertyByName("file_data").Value = &Doc_Data;

where &Doc_Data is populated from FILE_DATA field via a sql object as shown below

SELECT ATTACHSYSFILENAME  ,FILE_SEQ  ,FILE_DATA  FROM %Table(:1)  WHERE ATTACHSYSFILENAME = :2

When I comment the above mentioned peoplecode, the service returns data pertaining all other fields correctly, however when I uncomment that line, then the service errors.


Any help is greatly appreciated. Thanks.

Answers

  • Pavankumar Ch-Oracle
    Pavankumar Ch-Oracle Posts: 522 Silver Trophy - Community Leader

    Please review "E-IB: Is it Possible to Receive a 3rd Party Pdf File Via REST Service? (Doc ID 2724854.1)"

  • Jim Marion, ACE ♠
    Jim Marion, ACE ♠ Posts: 89 Silver Trophy

    It depends on the PDF. Modern PDFs are usually binary. The PDF spec, however, is text-based. If you have a text-based PDF, then yes, absolutely you may insert the PDF text into the Document. Otherwise, the code will fail because PeopleCode doesn't have facilities for handling binary data. The alternative is to base64 encode binary data, which is certainly possible, but would require both sides of the integration to understand that base64 is expected.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center