Skip to main content
This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.
LinkedIn
Copied!

Use Base64 encoding to send PDF files or images in a SOAP message

Summary

A developer asks: We want to send a SOAP request to our Process Commander application that will call a service.  Our application then needs to create a PDF form (filled in with the value of properties received in the SOAP request), and send the resulting PDF document to the caller in the SOAP response. 

The PDF document, created by eForm rules, is stored in the pyEForm property, which is of mode Java Object

What is the recommended way to return this PDF document as the SOAP response?


 

Suggested Approach

Property pyEForm holds the binary image of the PDF file. You need to make a Base64-encoded version of the image to send as characters over SOAP.  Speaking strictly, you need to text-encode it; and Base64 is the recommended technique. 

The receiving application needs to decode it, and then it would be back to the binary image of the PDF.

For an example of Base64 encoding, review the standard activity Work-. AttachEForm, which calls PublicAPI methods in com.pega.pegarules.pub.util.Base64Util to perform such encoding.

Suggest Edit
Did you find this content helpful?

50% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Ready to crush complexity?

Experience the benefits of Pega Community when you log in.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us