Logic App Transformation Error: InvalidXml. The XML validation failed. Data at the root level is invalid.

In this saga of Errors and Warnings, Causes, and Solutions in Azure – if you follow me, you know that this is one of my favorite topics – I got a fancy one. If you work in the Azure Integration space, you may be aware that the Integration Services Environment (ISE) will be retired on 31 August 2024. That means, if you have ISE, you must migrate your solutions to Logic App Consumption and/or Logic App Standard.

One of the tasks we are doing these days is, in fact, migrating that ISE solution. We are also taking this opportunity to improve our current solutions. And in one of these processes, we got the following error in one of our Logic Apps while trying to apply a transformation:

InvalidXml. The XML validation failed. Data at the root level is invalid. Line 1, position 1.

Cause

One of the main issues while migrating transformations from the old Logic App solution is the fact that all types of transformations, especially Liquid Transformations:

  • Transform JSON to JSON
  • Transform JSON to TEXT
  • Transform XML to TEXT
  • and Transform XML to JSON

has the same icon, which makes it virtually impossible for us to understand in the Logic App designer what type of transformation we are applying without going to the code view.

The only thing that is different is the Transform XML action

But this only happens in the new designer. If you are working inside Visual Studio, you only have the old designer, then this is even worse because all transformations use the same icon:

Normally, when this problem occurs, it means that you have chosen the incorrect Liquid Transformation type. Or the type of the map is incorrect.

In my case, I used the Transform XML action, and I should have used the Transform JSON to JSON.

Solution

Of course, the solution is quite simple. We have to select the correct action! But the main question is how to know what action to use.

If you try to see the action code view, it doesn’t tell you anything, as you can see in the picture below:

Instead, you have to switch to code view to really understand what you are doing inside that action:

Type Xslt means that this is a Transform XML from the XML connector.

Now, the second question you may ask is: can I fix the existing action without having to delete it, add a new one, and reconfigure it again?

Yes, there is, but not in the Logic App designer. You can fix this by switching to Code View and specifying:

  • The type property as Liquid.
  • When you specify the transformation as Liquid, you need to add a type of liquid transformation. by adding the following property:
    • king as, for example, JsonToJson.

While you are migrating those solutions, especially these transformation actions, checking the type of transformation in the code view will help you avoid future problems.

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! 

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

turbo360

Back to Top