Tutorial & Interface
Using Java Call-Outs
This interface and related tutorial demonstrate the use of the Data Mapper in Route configurations to transform between XML Formats. In this particular exercise, an existing Route (from “Data Mapping – Using Tabular Mappings”) is modified to transform a “PeopleA” XML format to the “PeopleF” XML format, which makes use of a Java method call-out to generate a unique ID.
In this tutorial, we’ll cover using the “Java Call-Out” feature of the Data Mapper to invoke Java methods. This tutorial expands on concepts covered in “Data Mapping Using Functions,” so users are expected to be familiar with that content.
This interface demonstrates how to use the eiConsole to separate a single data stream into multiple data streams each based on a subset of the original stream’s contents for independent handling and processing.
Transaction splitting may be used when:
- An incoming transaction contains multiple data payloads
- An incoming transaction needs to have different components processed separately
How to Use This Example
Download the INTERFACE to get started. (Once logged into the eiConsole it immediately shows up in your “PIE” inbox for use.)
Note: if you are not logged in to the eiConsole, or have arrived at this page via a browser, you will be prompted to log in before the Interface downloads into your eiConsole “PIE” inbox. Or if you have not downloaded and installed a FREE eiConsole Trial you will have the opportunity to register after you click the Interface Download link. Once you are logged in the interface will automatically download into your “PIE” inbox. First, you’ll see a screen pop up indicating that a new product is ready for download. Select the Download Now button. Once you’ve downloaded the Interface you can drag it into your current Working Directory and begin.
Next, follow the tutorial and walk through it step-by-step.
Creating & Configuring a New Route
Click “New” to open the Data Mapper. Load “PeopleA.xml” for the Source and “PeopleF.xml” for the target:
Repeat the mapping exercise from the previous tutorial, or copy the XSLT using the “XSLT View” tab:
For this tutorial, we’ll really just be making a single modification. The “SSN” field represents an identifier for a given Person. Rather than using this value, suppose we wanted to use a GUID instead. While you could conceivably do this in standard XSLT, the means of accomplishing this are probably well outside reasonable time constraints. For facilitating operations of this nature, calling out to the library of Java classes and methods is usually a better use of time.
Select the Custom tab, then the Uncategorized sub-tab. You should see “Java Extension” as an option:
Drag-and-Drop this item onto the “SSN” field in the mapping panel. This will raise a dialog querying you for a Java call string and the number of arguments:
For our call string, provide:
for Java Class Name: java.util.UUID
for Java Method Call: randomUUID
You do not need an ending set of parentheses, as the arguments count will provide them automatically. After making this change, save and test the transformation result. You should see a UUID / GUID in the SSN field:
You can use this mechanism to call any Java class or method available in the eiConsole and eiPlatform. This includes the standard Java runtime classes as well as quite a few commonly used libraries. Java call-outs are used for date formatting, database look-ups, saving and loading of files, and other utility functions.