Introduction
One of the key features of an integration platform is its ability to convert messages between different formats.
Messages play a critical role in integrating various solutions and applications. Different applications use different message formats to consume and deliver data. Therefore, to transfer data from one system to another, it is necessary to convert the message from one format or standard to another.
XML transformation can be achieved by using XSLT, which is a language for transforming XML documents into other XML documents or other formats. Frends provides its Task Transform for this purpose.
How to create a new XML message
In this example, you will learn how to create an XML message from the result of an SQL query.
The simple Process used in this example is illustrated below.
β
The Task configuration is shown above to provide you with the necessary details.
See Frends GitHub for more for more information about the MicrosoftSQL ExecuteQuery Task.
The MicrosoftSQL ExecuteQuery Task returns a JToken called Data, which contains two JObjects.
In this example, we will focus on the first object in the JToken and two specific properties marked with an arrow in the picture below.
To create a XML message from the MicrosoftSQL ExecuteQuery Task result, we use Foreach Task and a low-code reference with dot notation.
Upon closer inspection of the Send XML Message Task configuration, we can see that the Message field contains the XML message we are formulating. The Message field is set to the XML type, and the XML input mode allows you to enter valid XML as input instead of freeform text.
see Frends GitHub for more information about the Web RestRequest Tasks.
When sending the REST request, Frends will populate the low-code reference {{#var.product.ProductID}} with the actual value that, in our example case, is '680'.
By applying the same logic, the full HTTP request XML message with populated data is:
You can also apply C# code statements when formulating messages. The example below uses the TimeDate C# statement to formulate a simple XML message.
Note the curly brackets around the C# statement. C# statements can be used not only for XML messages but for all messages you want to create.
The resulting XML message:
The next article is Introduction to Creating an SQL query β a simple example.