How to Base64 Encode or Base64 Decode a PDF File

Hi all,
I need to convert a PDF file to Base64 to send it in a Request Soap field. Once the service returns the result in the same way it must be converted from Base64 to PDF file. I am using the component "Insert Document as Base64 into Database" but I can not find examples of how to configure this component. I have tried several ways to build the statement "Sql Statement" but it always returns error: << An error occurred in executing an Activity Class. >>
Does anyone have any idea of a solution?

  Discussion posts and replies are publicly visible

  • I believe you can break it in two. Encode to base64- function and send to web service.

    Get from web-service and decode base64 to document - smart service.

    Hope it helps!

  • Adding to the above comment.

    You need to be a bit cautious while dealing with Base64 data, as this may impact your server performance.

    Let's take an example to understand this better.

    • Let's consider you are encoding a 100 MB file into Base64 format, once after encoding is done, your file will grow and will be more than it's actual size, let's say 110 MB
    • During Base64 conversion Appian holds the entire data into the Buffers, means this will not be treated as the Streaming (flow) of Data like Binary Streaming (where read & write operations gets performed simultaneously to balance the load & achieve better performance). Hence more amount of usage of Base64 conversion may slow down your server performance as well

    I would recommend, if there are any possibilities to deal with Binary Stream then you should prefer that otherwise you should consider using Base64 conversion wisely.

  • Hi Jorge,

    If you're still in need of an answer, your SQL statement includes pv!record.folderId which won't work.

    According to the documentation provided with the plug-in, your SQL Statement should be   

                      "INSERT INTO DB_DocumentBase64 VALUES ( :folderId )"

    You then need to create an AC input variable called folderId and you can assign it the value pv!record.folderId

    Although unintuitive, this is how the documentation explains the configuration of this node and it worked for me Slight smile

    I hope this helps, let me know how you get on

    Jordan