advanced-data-handling-xslt-extension-gateway
Version 17.1 by marijn on 2022/05/05 10:04
XSLT Extension Gateway
In this microlearning, we will focus on the XSLT extension gateway. The XSLT extension gateway is a component in eMagiz that helps you to enrich your output XML message by retrieving data from an outside source.Should you have any questions, please contact academy@emagiz.com.- Last update: March 22th, 2021
- Required reading time: 6 minutes
1. Prerequisites
- Advanced knowledge of the eMagiz platform
- Advanced knowledge of XSLT
2. Key concepts
This microlearning centers around the XSLT extension gateway component in eMagiz By XSLT extension gateway we mean: A component within eMagiz that gives you the option to retrieve additional data while executing the transformation from an outside sourceVia the XSLT extension gateway you can retrieve data from multiple sources (REST Webservice, SOAP Webservice, Database, etc.) as long as the outside source can supply a response in near real-time.3. XSLT Extension Gateway
An XSLT Extension Gateway is a component within eMagiz that gives you the option to retrieve additional data while executing the transformation from an outside source. Via the XSLT extension gateway you can retrieve data from multiple sources (REST Webservice, SOAP Webservice, Database, etc.) as long as the outside source can supply a response in near real-time. This response is in turn used to enrich your output message with the correct information.3.1 Setting up the XSLT Extension Gateway
The first step of setting up an XSLT Extension Gateway is to add the XSLT Extension Gateway component to your flow and create two channels (one for the request and one for the response). You can do so by dragging the correct component on the canvas, creating the channels and linking the channels to the XSLT Extension Gateway. An example of how this will look is shown below:
3.2 Connect to the outside source
As stated before, via the XSLT extension gateway you can retrieve data from multiple sources (REST Webservice, SOAP Webservice, Database, etc.) as long as the outside source can supply a response in near real-time. In this example we will assume that you want to retrieve a Token from a REST Webservice that you need as part of your authorization when executing subsequent calls.In this case we will have to call a certain endpoint via a POST method. In the body of our message we need to send the username and password that we have received from the outside source. This outside source expects the body in XML.To make this a reality in eMagiz we first need to add an HTTP Outbound Gateway to the canvas and fill in the details.

3.3 Error handling
It could happen that something goes wrong while retrieving the relevant data from the outside will using the XSLT Extension Gateway. To ensure that the error handling does its work you need to link the XSLT Extension Gateway to the default error handling of eMagiz.You can easily do so by opening the XSLT Extension Gateway component, navigating to the Advanced tab, selecting the correct Error channel and setting the Reply timeout.

3.4 Write the XSLT
To succesfully call an XSLT extension gateway your custom XSLT needs five things:- A parameter that defines which component the XSLT extension gateway is within the flow
- A variable that calls the XSLT extension gateway and will hold the result
- A variable that defines what the input for your XSLT extension gateway will be
- A template match that copies your input
- A template match that ensures that the result of your XSLT extension gateway is correctly outputted
3.5 Connect XSLT to flow
The first step we need to take is to link the resource to the flow. To do so you navigate to the tab Resources on flow level, while in "Start Editing" mode. In this tab you have the option to Upload new resource



Practice
4. Assignment
Create within your flow an XSLT extension gateway setup as depicted above. The linking of the XSLT transformer to the XSLT extension gateway can be skipped in the exercise. This assignment can be completed with the help of the (Academy) project that you have created/used in the previous assignment.5. Key takeaways
- An XSLT Extension Gateway is a component within eMagiz that gives you the option to retrieve additional data while executing the transformation from an outside source.
- Via the XSLT extension gateway you can retrieve data from multiple sources (REST Webservice, SOAP Webservice, Database, etc.) as long as the outside source can supply a response in near real-time.
- This response is in turn used to enrich your output message with the correct information.
- Setting up an XSLT extension gateway means several components need to work in perfect unison
- Don't forget about the error handling