Wiki source code of Base64 encoding

Version 13.1 by eMagiz on 2022/06/09 13:13

Hide last authors
eMagiz 11.1 1 {{container}}
2 {{container layoutStyle="columns"}}
3 (((
eMagiz 1.1 4
5
6 Most of the time, you can use the standard tooling of eMagiz to manipulate the data so that it makes sense for the (external) party that receives the data. However, sometimes there are cases in which you need a little bit of extra complexity. This microlearning will explain one of those more complex scenarios. In this microlearning, we will learn how to use base64 encoding on your (input) message. This functionality is beneficial when the message is not encoded, but you need to send the data encoded to the external party.
7
eMagiz 13.1 8 Should you have any questions, please get in touch with [[academy@emagiz.com>>mailto:academy@emagiz.com]].
eMagiz 1.1 9
10 * Last update: August 26th, 2021
11 * Required reading time: 5 minutes
12
13 == 1. Prerequisites ==
14
15 * Basic knowledge of the eMagiz platform
16
17 == 2. Key concepts ==
18
19 This microlearning centers around base64 encoding.
20 We mean turning the string into an encoded string that the external party can handle.
21
22 Essential characteristics of this functionality are:
23
24 * Encoding (and decoding) of base64 strings take up additional memory (up to 33%)
25 * Separate integration for the base64 strings apart from metadata is advisable
26 * The component in eMagiz needs a base64 encoded string as input
27 * Multiple times encoding and encoding in the same integration is **not** advisable
28
29
30
31 == 3. Base64 encoding ==
32
33 Most of the time, you can use the standard tooling of eMagiz to manipulate the data so that it makes sense for the (external) party that receives the data. However, sometimes there are cases in which you need a little bit of extra complexity. This microlearning will explain one of those more complex scenarios. In this microlearning, we will learn how to use base64 encoding on your (input) message. This functionality is beneficial when the message is not encoded, but you need to send the data encoded to the external party.
34
35 Essential characteristics of this functionality are:
36
37 * Encoding (and decoding) of base64 strings take up additional memory (up to 33%)
38 * Separate integration for the base64 strings apart from metadata is advisable
39 * The component in eMagiz needs a base64 encoded string as input
40 * Multiple times encoding and encoding in the same integration is **not** advisable
41
42 The Base64 encode algorithm converts the original string into a base64 encoded string. Technically, it can be said that it converts eight-bit bytes into six-bit bytes. So when you have a string of ABC, you could manually convert this to an encoded format. You can find an excellent explanation of how it works [here](https://base64.guru/learn/base64-algorithm/encode). Luckily for us, eMagiz will do all the heavy lifting, and we do not have to take out pen and paper.
43
44 In the remainder of this microlearning, we will look at how you could implement this logic within the eMagiz tooling.
45
46 === 3.1 Implementation ===
47
48 To implement this logic, we need to add a separate component to our flow at the point where we want to encode the base64 string. This is generally part of your processing. The most logical place would be a flow associated with processing (i.e., offramp, exit gate, event processor).
49
50 First, we need to navigate to the Create phase of eMagiz and open the flow in which we want to add this logic. Once you have opened your flow, you need to enter "Start editing" mode. This mode allows you to change the flow in question and add the logic to the transformation within the flow. When you have done so, it becomes time to add the base64 encode component to the flow.
51
eMagiz 11.1 52 [[image:Main.Images.Microlearning.WebHome@intermediate-data-handling-base64-encode--component.png]]
eMagiz 1.1 53
54 At the component level, you need to define the input and output channel. Note that when the charset of the input message deviates from the UTF-8 default, you should specify the charset on the Advanced tab.
55
56 === 3.2 Use cases ===
57
58 Now that we know how to implement it, we can quickly look at possible use cases for this logic. We see this logic popping up mainly when dealing with attachments/files (i.e., pictures, pdf) within XML messages.
59
60 == 4. Assignment ==
61
62 Look for places where you could use this logic to aid your integration process within your (Academy) project.
63 This assignment can be completed with the help of your (Academy) project you have created/used in the previous assignment.
64
65 == 5. Key takeaways ==
66
67 Essential characteristics of this functionality are:
68
69 * Encoding (and decoding) of base64 strings take up additional memory (up to 33%)
70 * Separate integration for the base64 strings apart from metadata is advisable
71 * The component in eMagiz needs a base64 encoded string as input
72 * Multiple times encoding and encoding in the same integration is **not** advisable
73
74
75
76 == 6. Suggested Additional Readings ==
77
78 If you are interested in this topic and want more information, please read the help text provided by eMagiz and the following links:
79
80 * https://base64.guru/learn/base64-algorithm/encode
81 * https://www.base64encode.org/
82
83 == 7. Silent demonstration video ==
84
85 This video demonstrates how you could have handled the assignment and gives you some context on what you have just learned.
86
eMagiz 11.1 87 {{video attachment="intermediate-data-handling-base64-encode.mp4" reference="Main.Videos.Microlearning.WebHome"/}}
88 )))
eMagiz 1.1 89
eMagiz 11.1 90 ((({{toc/}}))){{/container}}
91 {{/container}}