The solution is composed of 2 steps that are performed sequentially. It assumes that the xml input file or JSON files are well formed, an error will be thrown if malformed xml or Json is added. For the rest of this example we will use a JSON example but the process is identical for xml.
Step 1 – Creating the Control file
Click the play button on either option 1 (JSON) on Figure 1 and add the example file. This will parse the file and create a control file that's downloadable as a csv.
Step 2 – Change the Control File
An Example JSON message and control file are shown in Figures 2 and 3 respectively.
Figure 2: Example JSON
Figure 3: Control File for JSON Message. Here the ColumnName is the name of the JSON Value, the Default column is the current value of the JSON in the message, MakeParameter specifies if we want to make data to be used in the template and JPath is the JPath to the value.
The only columns that should be edited by the user are "Default" and "MakeParameter". The Default column is populated initially by the value in the message but can be changed to a VIP function like RandomHelper.GetRandomInt() … etc.
Step 3 – Create Template from Control File and Message
Click Option 3 on Figure 1. Then enter the JSON example from Step 1 and the Control File created in Step 2. At this point the UI should look similar to this:
After clicking Execute a template file is created. An example is shown below in Figure 4.
Figure 4: Template created from using the control file in Figure 3.
Figure 4 shows how the user has replaced the values in the JSON with placeholders for Made data. This is configured by changing the MakeParameter column to 'TRUE' in the control file in Figure 3.
This Template file can then be used to generate multiple messages following the structure in Figure 4 but with different data values.