Azure Function to Apply XSLT Transformations

Azure Function to Apply XSLT Transformations

Another Azure Function? Can we accomplish the same with default capabilities inside Logic Apps or Azure API Management? These may be, once again, the questions that you are asking yourself at the moment. Because if we are using Azure Integration Services, we can easily use: 

  • If we are using Logic App Consumption we can use the Transform XML action in conjugation with an Integration Account.
  • If we are using Logic App Standard it already provides out-of-the-box support for applying XML transformations (using Transform XML action) without the Integration Account need.
  • Or, if you are using API Management, we can make use of the xsl-transform policy to apply an XSL transformation to XML in the request or response body.

Our main objective in creating this function was to use it inside Logic Apps Consumption to avoid needing an Integration Account. But that we will address later on in another blog post.

What does this Azure Function do?

The ApplyXSLTTransformation allows you to dynamically convert an XML payload into another XML, JSON, or any other format using XLST. To use this function, you must set up an Azure Storage Account and a container to store the XSLT files.

To trigger this function, you need to:

  • In the Body, send an XML payload
  • You should specify the following mandatory headers:
    • Content-Type as text/xml, or application/xml.
    • XsltFileName with the name of the xslt file present in the storage account.
  • Optionally, you can set the following header:
    • Output-Content-Type: this will specify the outcome (response) content-type. The default value is text/xml.

Once again, our main objective in creating this function was to use it inside Logic Apps Consumption to avoid needing an Integration Account. But that we will address later on in another blog post. However, it can be used in other scenarios.

Where can I download it?

You can download the complete Azure Functions source code here:

Hope you find this helpful! So, if you liked the content or found it useful and want to help me write more, you can buy (or help me buy) my son a Star Wars Lego! 

Thanks to my team member Luís Rigueira for helping me realize and implement this idea.

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc.

He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.
View all posts by Sandro Pereira

Azure Functions to Convert XML into JSON

Azure Functions to Convert XML into JSON

Why do we need this Azure Function? This may be the question that you are asking yourself at the moment. Because if we are using Azure Integration Services, we can easily use: 

  • The json() expression that returns the JSON type value or object for a string or XML inside Logic Apps
  • Or the xml-to-json policy that converts a request or response body from XML to JSON inside API Management.

Well, our main objective in creating this function was to be used in Azure API Management to overcome some non-conforming behaviors while converting XML to JSON of the xml-to-json policy, mainly if that XML contains prefixes.

As you may know, prefixes are used inside XML to prevent name conflicts. And when we use them, a namespace for the prefix must be defined. They will work as an abbreviation of the full XML namespace. The namespace declaration has the following syntax:

  • xmlns:prefix=”URI“.

allowing MyField to be written in this namespace as prefix:MyField rather than, say, {URI}MyField

And in Enterprise Integration solutions, it is quite normal to see XML documents and Schemas using several prefixes.

Later in another blog post, we will explain the issue behind the decision to create this Azure Function in detail.

And what does this Azure Function do?

The ConvertXMLtoJSON Azure Function, as the name mentions, converts an XML payload to JSON. This function can be used to modernize APIs based on XML-only backend web services.

Once again, our main objective in creating this function was to be used in Azure API Management to overcome some non-conforming behaviors of the xml-to-json policy. However, it can be used in other scenarios.

Where can I download it?

You can download the complete Azure Functions source code here:

Hope you find this helpful! So, if you liked the content or found it useful and want to help me write more, you can buy (or help me buy) my son a Star Wars Lego! 

Thanks to my team member Luís Rigueira for helping me realize and implement this idea.

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc.

He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.
View all posts by Sandro Pereira

Merry Christmas & Happy New Year 2023

Merry Christmas & Happy New Year 2023

Season’s Greetings to All Our Valued Readers!

As the snowflakes gently settle (in theory because here in Porto, there is no snow!) and the jingle bells echo in the distance, we find ourselves at the magical juncture of the year where warmth (in theory again because it is cold), joy, and togetherness take center stage. It’s that time again when twinkling lights and festive cheers fill the air — yes, Christmas is here, and a New Year is just around the corner!

Thanks in advance for all the support and encouragement given throughout this year. We hope that the next year will be filled with new, distinct contributions. We will promise that we will continue to share knowledge, hoping that they can help someone.

May your holiday season be filled with moments of laughter, love, and shared joy with family and friends. As we bid farewell to 2023, we look forward to the adventures that await us in 2024 and remember the sage advice: “Start using proper names from day one!“. With a touch of intergalactic flair, we send our wishes for a Stellar Holiday Season and an Out-of-This-World New Year.

Let’s continue to reach for the stars and dream beyond the limits of the universe. May the Force be with you!

Greetings from Diogo, Luis, and Sandro!

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc.

He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.
View all posts by Sandro Pereira

CONNECTED Conference 2023 | November 15, 2023 | API Management: Best practices, tips and tricks | Video

CONNECTED Conference 2023 | November 15, 2023 | API Management: Best practices, tips and tricks | Video

Last November 15, 2023, I had the pleasure of delivering a session about Azure API Management at the CONNECTED Conference 2023. This conference is one of the most important events on Microsoft Integration in German-speaking countries, and it has been a great honor for me to be invited to participate in the last few years.

My session was about API Management: Best Practices, Tips and Tricks where I talked about best practices and small tips and tricks that we can apply to our Azure Integration projects when using Azure API Management.

  • Session name: API Management: Best Practices, Tips and Tricks.
  • Abstract: Unleash the full potential of Azure API Management with this session focused on efficient integration building. Discover tips and tricks that empower developers to be more productive while adhering to best practices, resulting in reliable and effective integrations.

Today I have the pleasure of informing you that the session is now available online:

[embedded content]

You can see all the session videos of the conference, most of them in German, here: https://www.quibiq.de/aktuelles/quievents/connected/on-demand/

Hope you find this helpful! So, if you liked the content or found it helpful and want to help me write more content, you can buy (or help buy) my son a Star Wars Lego! 

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc.

He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.
View all posts by Sandro Pereira