Skip to main content
Skip table of contents

Defining Route Transformations

After microservices are connected via routes, transformations can be defined on routes having schema mismatches. In the example shown below, there is a schema mismatch between the Feeder output port and CBR input port and hence the route is shown as a dotted line.

A route transformation can be defined in any one of the following ways:

  • Defining a Mapper Project
  • Providing a Custom XSL
  • Using a Named Configuration
  • Importing from a Zip file


Figure 1: Route Transformation options

Defining a Mapper Project

This operation allows the user to define mappings between the source and target port schema using the Fiorano eMapper.

To define the transformation using eMapper, perform the steps below:

  1. Right-click the route and select the Mapper Project option from the Configure Transformation sub menu.

    Route transformation editor will be opened which automatically picks up the schemas on connected ports.

  2. Transformations can be defined on schemas by connecting elements from input structure with output structure elements. Additional computations on elements can also be made by using functions present within the Funclet view.


    Figure 2: Route transformation editor

    While the editor is open for defining transformations, the Event Process editor will be in the non-editable state to prevent further changes till the transformation editor is closed. Once the transformation editor is closed it is then possible to edit the transformation.

Once the transformation is defined and closed, the transformation will be set on the route and the route appears bold as in the figure below.


Figure 3: Route with the transformation set

Providing a Custom XSL

To provide a Custom XSL, perform the steps below:

  1. Right-click the route and select Custom XSL from the Configure Transformation menu.
  2. In the Custom XSL dialog box that is displayed, provide the XSL in the first tab and XSL for the JMS Message (if any) in the second tab. Click OK to set the transformation on the route. The XSLT Engine to be used (Xalan / Saxon / XSLTC) can be specified from the drop-down menu in the top right corner.
  3. The XSL provided can be tested by clicking the Test button.
Example

By following the steps mentioned above, set the XSL below as a Route Transformation.

Use this stylesheet as an example. All namespaces are deleted from an XML document.

CODE
<?xml version="1.0"?>
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
 <xsl:output indent="yes" method="xml" encoding="utf-8" omit-xml-declaration="yes"/> 
 <!-- Stylesheet to remove all namespaces from a document -->
 <!-- NOTE: this will lead to attribute name clash, if an element contains
 two attributes with same local name but different namespace prefix -->
 <!-- Nodes that cannot have a namespace are copied as such --> 
 <!-- template to copy elements -->
 <xsl:template match="*">
 <xsl:element name="{local-name()}">
 <xsl:apply-templates select="@* | node()"/>
 </xsl:element>
 </xsl:template> 
 <!-- template to copy attributes -->
 <xsl:template match="@*">
 <xsl:attribute name="{local-name()}">
 <xsl:value-of select="."/>
 </xsl:attribute>
 </xsl:template> 
 <!-- template to copy the rest of the nodes -->
 <xsl:template match="comment() | text() | processing-instruction()">
 <xsl:copy/>
 </xsl:template> 
 </xsl:stylesheet>

 To test the XSL, click the Test button and provide an XML in the input tab and click Transform. The output will be displayed in the Output tab.


Figure 4: Custom XSL Dialog



Figure 5: Transformed XML

Using a Named Configuration

Transformations can also be saved in the Configuration Repository as Named Configurations and can be used where required.

To Use a Named Configuration as a route transformation, right-click on the route and select Use Named Configuration. Choose the configuration to be used from the list of available named configurations.

Importing from a Zip file

Users can also import previously exported transformations from a .Zip file by selecting the Import from Archive File [.Zip] from the Configure Transformation menu.

To save the transformation defined on a route as an archive file, right-click on the route on which the route transformation is defined and select Save Configuration as  > Archive File.

The transformation defined on the route is executed inside the Peer server. It is advised not to define complex mappings (involving huge schemas and mappings) using Route Transformations since it may affect the Peer server performance. For complex transformations, the XSLT microservice can be used.

To remove a transformation defined on the route, right-click the route and select the Clear Transformation option.

Route transformation can be changed on the route at both configuration time and runtime. During runtime, if the transformation is changed, the changes are automatically deployed to the server. The user need not explicitly synchronize the event process for the changes to take effect.

To define selectors for the data flow through an event route, refer the Configuring Selectors on Routes section.


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.