Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

doing xml replace operations in logic apps

How do we replace strings within an XML payload in logic apps?

input

<root>
  <alexIsAwesome>yes he is</alexIsAwesome>
  <bytes>sdfsdfjijOIJOISJDFQPWORPJkjsdlfkjlksdf==</bytes>
  <bytes>SFSDFsdfsdgfjgjkfjsdlfkjlksdf==</bytes>
</root>

desired result

<root>
  <alexIsAwesome>yes he is</alexIsAwesome>
  <bytes>replacetext1</bytes>
  <bytes>replacetext2</bytes>
</root>

How do we iterate through XML and replace text within nodes? Please keep in mind that the input node might be 100mb in size!

like image 943
Alex Gordon Avatar asked May 20 '19 17:05

Alex Gordon


People also ask

What is liquid transformation?

Liquidity transformation – the creation of liquid claims that are backed by illiquid assets – is a key function of many financial intermediaries.


2 Answers

If you already loading the XML content in you Logic App, you could just use the replace function. Note that there are certain limits that you may end up hitting on successive runs.

If you have more complex use cases, you could instead try one of the following

For payloads up to 50MB, you could simply use the new inline code feature to perform the transformations you need. You would have to convert the payload to JSON first (using json) and then back to XML after (using xml).

But for much bigger payloads and/or more complex transformations, it would be best to offload this to a Function called from Logic App.

The best approach here would be to store the payload in Azure Blob Storage and your function would have a Blob Input and Blob Output binding.

like image 81
PramodValavala-MSFT Avatar answered Oct 01 '22 13:10

PramodValavala-MSFT


You could use an Integration account with the Transform XML action, by pointing to a defined Map, either XSLT or Liquid type. logic apps enterprise integration maps

like image 41
AdAstra Avatar answered Oct 01 '22 14:10

AdAstra