A WTX map with single input and single output can be configured by adding a Transform Binary Action straight forward in DataPower. But when WTX map has multiple inputs and outputs, Transform Binary Action configurations will be complex. This article will give an overview of how to address this issue.
What do we cover in this article
1. Generating multiple output xml structure based on the content of a single input xml file using WTX map.
2. Generating multiple output xml files with respect to single input xml file using WTX map.
3. Generating single output xml file structure with respect to multiple input xml files using WTX map.
Scenario -1: Generating multiple output xml structure based on the content of a single input xml file
Challenge
In the traditional straight forward approach, multiple WTX maps need to be created to generate multiple xml output, as well in DataPower multiple xslt’s should be created to retrieve the outputs of WTX maps.
Solution
Instead of creating multiple maps, a single map is built to handle this challenge.Following are the prerequisites to build WTX Map in order to address this challenge.
- One TypeTree/XSD for Input Card describing the metadata.
- ‘n’ TypeTree/XSD for output xml structures.
- Additional type tree to collect the generated xml output, it’s just a place holder.
Steps to create WTX Map
Using WebSphere Transformation Extender create a map source file with an extension (.mms) under Extender Project. In order to transfer the data content from source formats to target formats input and output card should be created
Create input card
Using input schema,create the input card
Input card setting
Following are the input card settings to specify CardName, the TypeTree,Type and Input xml file path.
Multiple output cards synchronized in a single output card
Create output card1
Using output schema,create the outputcard1
Output card1 setting
Under Target Rule settings set Target as sink
Note: Sink Adapter is used to bypass the creation of multiple output files
To know more about Sink Adapter refer
Output card2
Similar to output card1, create the output card2 using output schema.
Output card2 setting
Similar to output card1, create the output card2 with Target set as sink.
Final output card template
Below is the final output card, created using the output schema to incorporate the other two xml structure (OutputCard1, OutputCard2) when specified condition is met.
Final output card setting
Following are the output card settings to specify CardName, the TypeTree,Type and output xml file path.
Rule used
Based on Designation Flag value, the personal details from the respective template of the xml structure is displayed as an output
Note: Text function is used here to convert Objects to data
To know more about Text function refer
Map structure with multiple xml structures merged to a single xml file with respect to single input xml file
Transform binary action configuration in DataPower
The Future of Big Data
With some guidance, you can craft a data platform that is right for your organization’s needs and gets the most return from your data capital.
When the transformation map defines either multiple inputs or multiple outputs, configure WTX map following the below steps
1. Transform Binary action is created in such a way that transformation map takes only one
input and creates only one output. Record the name of the action.
2. Select Objects → XML Processing → Processing Action to display the catalog.
3. Click the name of the previously created action.
4. Choose Explicit from the Locate Named Inputs and Outputs list.
5. Define explicit named inputs.
a. Click the Named Inputs tab.
b. Click Add.
- Specify the name of an input CardName in the Name field of the map. This must be the same as CardName in the map file.
- Specify the name of the DataPower context that contains the input data in the Context field.
- Click Apply.
c. Repeat the previous step to create another named input.
6. Define named outputs.
a. Click the Named Outputs tab.
b. Click Add.
- Specify the name of output CardName in the Name field of the map. This must be the same as CardName in the map file.
- Specify the name of the DataPower context that contains the output data in the Context field.
- Click Apply.
c. Repeat the previous step to create another named output.
Scenario-2 : Generating multiple output xml files with respect to single input xml file
Challenge
In the traditional straight forward approach, multiple WTX maps need to be created to generate multiple xml output, as well in DataPower multiple xslt’s should be created to retrieve the outputs of WTX maps.
Solution
Instead of creating multiple maps, a single map is built to handle this challenge
Steps to create WTX Map
Single input card
Using the input schema, create the Input card.
Multiple output cards
Output cards template
Output card1
Using the output schema, create output card1
Output card2
Using the output schema, create output card2
Map with multiple output xml file generated with respect to single input xml file
Map settings
In order to generate multiple outputs, Map setting has to be done under transformation extender in the following way.
Preferences ->Transformation Extender ->Map ->Maximum number of ‘From’ cards
Note: – The same setting applies for Multiple Inputs too.
Transform binary action configuration in Datapower
Same settings have to be repeated for this scenario as in scenario 1.
But Multiple Named Outputs should be declared.
Multiple Outputs
1. Datapower ContextNames should be unique
2. WTX Output Card Names should be unique
3. In case of multiple outputs, the output context configured in the Transform Binary action is just a dummy context.
Scenario -3: Generating single output xml file structure with respect to multiple input xml files
Challenge
In the traditional straight forward approach, multiple WTX maps need to be created to generate multiple xml output, as well in DataPower we have to create multiple xslt’s to retrieve the outputs of WTX maps.
Solution
Instead of creating multiple maps, a single map is built to handle this challenge.
Multiple input cards
Input card1
Using input schema, create input card1.
Input card2
Using the input schema, create input card2
Single output card
Using the output schema, create output card
Map settings
Same settings have to be repeated as in scenario 2 in order to set Multiple Input Cards.
Map with single output xml file with respect to multiple input xml file
Transform binary action configuration in Datapower
Same settings have to be repeated for this scenario as in scenario 1 and scenario 2. But Multiple Named Inputs should be declared.
Multiple Inputs
1. Datapower Context Names should be unique
2. WTX Input Card Names should be unique
3. In case of Multiple Inputs, the input context configured in the Transform Binary action is just a dummy context.
4. The input contexts declared using <dp:set> cannot be used in the Named Inputs of binary transform action.