This article provides a Java mapping which encodes Base64 in SAP PI/PO. I will implement a simple interface to demonstrate the use of the Java mapping. It’s part of a series of posts about Base64 encoding and decoding and you can check the Base64 decoding Java Mapping example in my previous article.
Similarly, you can also use User Defined Functions (UDF) to encode and decode Base64 in SAP PI/PO. But in this article, I’ll show you how to use Java mapping for encoding.
Base64 Encoding Java Mapping Scenario:
Source message node ‘TextMessage’ contains a string value that should be encoded. Base64 encoded string should be mapped to target message node ‘Base64EncodedString’.
String ‘Welcome!’ translates to ‘V2VsY29tZSE=’ in Base64 schema.
System Detail Example was Implemented:
This example will be implemented in an SAP Process Integration (PI) system version 7.50 single stack.
Functionality of Java Mapping:
First functionality of Java mapping is to encode the text in Base64 schema. String value in sender message node ‘TextMessage’ should be encoded and included in target message element ‘Base64EncodedString’.
Then, Java mapping should create a complete target message xml with other elements, namespaces, etc.
If the target system is an SAP system, you can decode a Base64 string using ABAP Function Modules (FM) or ABAP class CL_HTTP_UTILITY. You can read more about how to encode or decode Base64 in SAP in my previous post.
Source Message - Base64 Encoding Java Mapping Example