Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
engswee
Active Contributor

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

















Number Module Name Type Module Key


<Depending on position of module in chain>

1) Asynchronous scenario,

Normally before the last module in channels

2) Synchronous scenario,

Before last module to convert request payload

After last module to convert response payload
Custom_AF_Modules/FormatConversionBean Local Enterprise Bean <Any Arbitrary Value>

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.



























































Parameter Name Allowed values Default value Remarks
converterClass

PI - com.equalize.xpi.af.modules.base64.Base64EncodeConverter

CPI - com.equalize.converter.core.Base64EncodeConverter
Required field. Determines conversion class
outputType plain, xml Required field. Indicates type of output data

  • plain = Base64 string as plain output text

  • xml = Base64 string embedded in XML element of XML payload


documentName

Required field when outputType = 'xml'.

Document name of root element of XML output
documentNamespace

Required field when outputType = 'xml'.

Namespace of root element of XML output
base64FieldName base64Content

Available when outputType = 'xml'.

Field name of  XML element containing Base64 string
compress Y,N N Compress input content before encoding into Base64 string
messageLog pre, post Saves a log version of the message that is viewable in Message Monitor

  • pre = saves payload before conversion

  • post = saves payload after conversion


Available only in PI
logLocation Name of log version when messageLog is populated. Location defaulted to value in messageLog if logLocation not populated. Available only in PI

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





















Parameter Name Parameter Value
converterClass com.equalize.xpi.af.modules.base64.Base64EncodeConverter
outputType plain
compress Y

Result











Input
Output

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

18 Comments
Labels in this area