Update 4 Sep 2018: Now available in CPI as well.
Introduction
In my previous article
Base64DecodeConverter - Base64 decoding made easy!, I introduced a new converter for
FormatConversionBean to handle decoding of Base64 content.
This article covers
Base64EncodeConverter, which handles encoding of content into a Base64 string in either plain text file or embedded in an XML payload.
Source Code and Deployment Archive
Refer to following blog on location of source code and/or EAR deployment file.
FormatConversionBean - One Bean to rule them all!
Usage of Module in Communication Channel
Module Processing Sequence
Module Parameter Reference
Below are the parameters for configuration of the module for Base64 encoding. Certain parameters will automatically inherit the default values if it is not configured.
Example Scenarios
Here are some example scenarios of the behavior of the conversion based on different configuration options.
Scenario 1
- Encode content into Base64 string in plain output text
- Content will be compressed before encoding into Base64
Module parameters
Result
Scenario 2
Screenshot of actual configuration and testing are shown below.
- Encode content into Base64 string, and embed in XML payload
- Output XML's root element, namespace and field containing base 64 string specified
Module configuration on an SFTP receiver channel.
The input content to be encoded is sent via the Send Test message function.
The log version 'b64embedxml' shows the content after encoding. The Base64 string is embedded into an XML payload.
The audit log shows the trace of steps being executed by the module.
The encoded output is verified using
Base64 Decode - Online to decode the generated Base64 string to retrieve back the original content.
Conclusion
With this new addition to FormatConversionBean, encoding of Base64 content can also now be easily handled without additional custom development