How to Process XML in Azure Logic App
We recently shipped Preview of [Enterprise Integration Pack] (EIP) for Logic Apps. As part of this release, a bunch of xml processing capabilities have been added to Logic Apps.
- [JSON to XML] and vice versa: You can use the json() and xml() functions that are natively available in Logic Apps definition.
- XML Transform: You can now use the new XML Transform action which is based upon XSLT 1.0.
Beyond these, Logic Apps also has HTTP requests/response capabilities which can be used to call HTTP endpoints.
Hope this helps.
Thanks,Vinay
- Receive XML POST request.
Transform the XML. - Use content as triggerBody() and map using XSLT. You can set the XML format here.
<?xml version='1.0'?><xsl:stylesheet version="1.0"><xsl:template match="/"><Header><Something><xsl:value-of select="soap-env:Envelope/soap-env:Body/a:Something/@value"/></Something></Header></xsl:template></xsl:stylesheet>
Transform XML to JSON - Use content body('transform_XML') and map using XML to Json.
{"Something": "{{content.Something.Value}}"
- Parse JSON - Use content body('transform_XML_to_JSON')
HTTP Response - set the values you want returned as body('Parse_JSON')['Value'] into the Body.
<Header><Something><value = "body('Parse_JSON')['Value']"/></Something></Header>
You can also create a blob with this and send to a data factory.
You can also use Function Apps w/NewtonSoft (JSON.net). Logic Apps are amazing, but they are not the sandwich AND the chips... at least not quite yet.
You should be able to nest a Function App in a Logic App. Use NewtonSoft (In Function App) to support the parsing XML>JSON, JSON>XML