Advertise with Googlier.com  Steve Spencer's Blog - Biztalk Blogging on Azure Stuff http://blogs.recneps.net/ http://www.rssboard.org/rss-specification BlogEngine.NET 2.9.1.0 en-US http://blogs.recneps.net/opml.axd http://www.dotnetblogengine.net/syndication.axd Steve Spencer Steve Spencer's Blog 0.000000 0.000000 Processing a flat file with Azure Logic Apps <p>[Update: 5th Aug 2018 – This post is still relevant especially the integration account, schemas and maps and I&nbsp; have written a new blog that builds on this one and integrates into SQL&nbsp; -&nbsp; <a href="http://blogs.recneps.org/post/Using-Azure-Logic-Apps-to-Import-CSV-to-SQL-Server">Using Azure Logic Apps to Import CSV to SQL Server</a>] <p>A lot of companies require the transfer of files in order to transact business and there is always a need to translate these files from one format to another. Logic Apps provides a straight forward way to build serverless components that provide the integration points into your systems. This post is going to look at Logic apps enterprise integration to convert a multi-record CSV file into and XML format. Most of the understanding for this came from the following post: <p><a href="https://seroter.wordpress.com/2016/09/09/trying-out-standard-and-enterprise-templates-in-azure-logic-apps/">https://seroter.wordpress.com/2016/09/09/trying-out-standard-and-enterprise-templates-in-azure-logic-apps/</a> <p>Logic Apps can be created in Visual Studio or directly in the Azure Portal using the browser. Navigate to the azure portal <a href="https://portal.azure.com">https://portal.azure.com</a> click the plus button at the top of the right hand column, then Web + Mobile then Logic App <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image002.jpg"><img title="clip_image002" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image002" src="http://blogs.recneps.org/image.axd?picture=clip_image002_thumb.jpg" width="492" height="484"></a> <p>Complete the form and click Create <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image003.png"><img title="clip_image003" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image003" src="http://blogs.recneps.org/image.axd?picture=clip_image003_thumb.png" width="251" height="502"></a> <p>This will take a short while to complete. Once complete you can select the logic app from you resource list to start to use it. <p>If you look at my recent list <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image005.jpg"><img title="clip_image005" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image005" src="http://blogs.recneps.org/image.axd?picture=clip_image005_thumb.jpg" width="464" height="198"></a> <p>You can see the logic app I’ve just created but you will also see my previous logic app and you will also notice that there is also an integration account and an Azure function. These are both required in order to create the necessary schemas and maps required to translate the CSV file to XML. <p>The integration account stores the schemas and maps and the Azure function provides some code that is used to translate the CSV to XML. <p>An integration account is created the same way as a logic app. The easiest way is to click on the plus symbol and then search for integration <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image007.jpg"><img title="clip_image007" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image007" src="http://blogs.recneps.org/image.axd?picture=clip_image007_thumb.jpg" width="615" height="149"></a> <p>Click on Integration Account then Create <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image009.jpg"><img title="clip_image009" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image009" src="http://blogs.recneps.org/image.axd?picture=clip_image009_thumb.jpg" width="617" height="466"></a> <p>Complete the form <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image010.png"><img title="clip_image010" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image010" src="http://blogs.recneps.org/image.axd?picture=clip_image010_thumb.png" width="254" height="516"></a> <p>Then Create. Once created you can start to add your schemas and maps <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image012.jpg"><img title="clip_image012" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image012" src="http://blogs.recneps.org/image.axd?picture=clip_image012_thumb.jpg" width="532" height="437"></a> <p>You will now need to jump into Visual Studio to create your maps and schemas. You will need to install the <a href="https://www.microsoft.com/en-us/download/details.aspx?id=53016">Logic Apps Integration Tools for Visual Studio</a> <p>You will need to create a schema for the CSV file and a schema for the XML file. These two blog posts walk you through creating a flat file schema for a <a href="https://sandroaspbiztalkblog.wordpress.com/2015/10/14/biztalk-server-teach-me-something-new-about-flat-files-or-not-files-delimited-by-symbols/">CSV file</a> and also a <a href="https://sandroaspbiztalkblog.wordpress.com/2015/11/03/biztalk-server-teach-me-something-new-about-flat-files-or-not-positional-files/">positional file</a> <p>I created the following two schemas <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image014.jpg"><img title="clip_image014" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image014" src="http://blogs.recneps.org/image.axd?picture=clip_image014_thumb.jpg" width="687" height="351"></a> <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image016.jpg"><img title="clip_image016" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image016" src="http://blogs.recneps.org/image.axd?picture=clip_image016_thumb.jpg" width="689" height="358"></a> <p>Once you have create the two schemas you will need to create a map which allows you to map the fields from one schema to the fields in the other schema. <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image018.jpg"><img title="clip_image018" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image018" src="http://blogs.recneps.org/image.axd?picture=clip_image018_thumb.jpg" width="980" height="191"></a> <p>In order to upload the map you will need to build the project in Visual Studio to build the xslt file. <p>The schemas and map file project can be found in <a href="https://github.com/sdspencer-mvp/AzureStuff">my repository on GitHub</a> <p>To upload the files to the integration account, go back to the Azure portal where you previously selected the integration account, click Schemas then Add <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image020.jpg"><img title="clip_image020" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image020" src="http://blogs.recneps.org/image.axd?picture=clip_image020_thumb.jpg" width="633" height="447"></a> <p>Complete the form, select the schema file from your Visual Studio project and click OK. Repeat this for both schema files. You do the same thing for the map file. You will need to navigate to your bin/Debug (or Release) folder to find the xslt file that was built. Your integration account should now show your schemas and maps as uploaded <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image021.png"><img title="clip_image021" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image021" src="http://blogs.recneps.org/image.axd?picture=clip_image021_thumb.png" width="559" height="406"></a> <p>There’s one more thing to do before you can create your logic app. In order to process the transformation some code is required in an Azure Function. This is standard code and can be created by clicking the highlighted link on <a href="https://docs.microsoft.com/en-us/azure/app-service-logic/app-service-logic-enterprise-integration-transform">this page</a>. Note: If you haven’t used Azure Functions before then you will also need to click the other link first. <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image023.jpg"><img title="clip_image023" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image023" src="http://blogs.recneps.org/image.axd?picture=clip_image023_thumb.jpg" width="677" height="231"></a> <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image025.jpg"><img title="clip_image025" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image025" src="http://blogs.recneps.org/image.axd?picture=clip_image025_thumb.jpg" width="610" height="508"></a> <p>This creates you a function with the necessary code required to perform the transformation <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image027.jpg"><img title="clip_image027" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image027" src="http://blogs.recneps.org/image.axd?picture=clip_image027_thumb.jpg" width="618" height="347"></a> <p>You are now ready to start your logic app. Click on the Logic App you created earlier. This will display a page where you can select a template with which to create your app. <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image029.jpg"><img title="clip_image029" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image029" src="http://blogs.recneps.org/image.axd?picture=clip_image029_thumb.jpg" width="622" height="388"></a> <p>Close this down as you need to link your integration account to your logic app. <p>Click on Settings, then Integration Account and pick the integration Account where you previously uploaded the Schemas and Map files. Save this and return to the logic app template screen. <p>Select VETER Pipeline <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image031.jpg"><img title="clip_image031" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image031" src="http://blogs.recneps.org/image.axd?picture=clip_image031_thumb.jpg" width="571" height="425"></a> <p>Then “Use This Template”. This is the basis for your transformation logic. All you need to do now is to complete each box. <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image032.png"><img title="clip_image032" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image032" src="http://blogs.recneps.org/image.axd?picture=clip_image032_thumb.png" width="457" height="588"></a> <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image034.jpg"><img title="clip_image034" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image034" src="http://blogs.recneps.org/image.axd?picture=clip_image034_thumb.jpg" width="462" height="323"></a> <p>In Flat File Decoding &amp; XML Validation, pick the CSV schema <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image035.png"><img title="clip_image035" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image035" src="http://blogs.recneps.org/image.axd?picture=clip_image035_thumb.png" width="463" height="293"></a> <p>In the transform XML <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image036.png"><img title="clip_image036" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image036" src="http://blogs.recneps.org/image.axd?picture=clip_image036_thumb.png" width="464" height="458"></a> <p>Select the function container, the function and the map file <p>All we need to do now is to return the transformed xml in the response message. Click “Add an Action” on Transform XML and search for Response. <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image038.jpg"><img title="clip_image038" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image038" src="http://blogs.recneps.org/image.axd?picture=clip_image038_thumb.jpg" width="468" height="354"></a> <p>Pick the Transformed XML content as the body of the response. Click save and the URL for the logic app will be populated in the Request flow <p><a href="http://blogs.recneps.org/image.axd?picture=clip_image039.png"><img title="clip_image039" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image039" src="http://blogs.recneps.org/image.axd?picture=clip_image039_thumb.png" width="468" height="182"></a> <p>We now have a Request that takes the CSV in the body and it returns the XML transform in the body of the response. You can test this using a tool like PostMan or Fiddler to send in the request to the request URL above. <p>There is also a test CSV file in <a href="https://github.com/sdspencer-mvp/AzureStuff">my repository on GitHub</a> which can be used to test this. <p>My <a href="http://blogs.recneps.org/post/Diagnosing-Azure-Logic-App-Faults">next post</a> covers how I diagnosed a fault with this Logic App http://blogs.recneps.net/post/Processing-a-flat-file-with-Azure-Logic-Apps http://blogs.recneps.net/post/Processing-a-flat-file-with-Azure-Logic-Apps#comment http://blogs.recneps.net/post.aspx?id=6dbe60d0-eec8-4f50-b7c8-a690554ac046 Mon, 28 Nov 2016 21:56:24 +0000 Azure Azure App Service Biztalk Microsoft Azure Visual Studio Logic Apps steve http://blogs.recneps.net/pingback.axd http://blogs.recneps.net/post.aspx?id=6dbe60d0-eec8-4f50-b7c8-a690554ac046 1120 http://blogs.recneps.net/trackback.axd?id=6dbe60d0-eec8-4f50-b7c8-a690554ac046 http://blogs.recneps.net/post/Processing-a-flat-file-with-Azure-Logic-Apps#comment http://blogs.recneps.net/syndication.axd?post=6dbe60d0-eec8-4f50-b7c8-a690554ac046 BlackMarble SOA/BizTalk Event <p>Thanks to everyone who sat and listened to my presentations on BizTalk RFID, ESB and ISB. I hope that you found them useful.</p> <p>As promised here are the links:</p> <p>Biztalk RFID : <a href="http://www.microsoft.com/biztalk/en/us/rfid.aspx">http://www.microsoft.com/biztalk/en/us/rfid.aspx</a></p> <p>Blue C Sushi : <a href="http://www.microsoft.com/casestudies/casestudy.aspx?casestudyid=201405">http://www.microsoft.com/casestudies/casestudy.aspx?casestudyid=201405</a> <p>ESB Guidance : <a href="http://msdn.microsoft.com/en-us/library/cc487894.aspx">http://msdn.microsoft.com/en-us/library/cc487894.aspx</a> <p>Robert's Blog on installing ESB: <a title="ESB Guidance Setup Walk through (DRAFT)" href="http://blogs.blackmarble.co.uk/blogs/boss/archive/2007/12/14/esb-guidance-setup-walk-through.aspx">ESB Guidance Setup Walk through (DRAFT)</a> <p>Biztalk Services/ISB: <a title="http://biztalk.net/" href="http://biztalk.net/">http://biztalk.net/</a></p> http://blogs.recneps.net/post/blackmarble-soa-biztalk-event http://blogs.recneps.net/post/blackmarble-soa-biztalk-event#comment http://blogs.recneps.net/post.aspx?id=196c1fcd-a7e3-4dc0-9a63-5496e7216f0e Thu, 03 Jul 2008 09:44:55 +0000 Biztalk BlackMarble Events Steve http://blogs.recneps.net/pingback.axd http://blogs.recneps.net/post.aspx?id=196c1fcd-a7e3-4dc0-9a63-5496e7216f0e 6 http://blogs.recneps.net/trackback.axd?id=196c1fcd-a7e3-4dc0-9a63-5496e7216f0e http://blogs.recneps.net/post/blackmarble-soa-biztalk-event#comment http://blogs.recneps.net/syndication.axd?post=196c1fcd-a7e3-4dc0-9a63-5496e7216f0e Oslo in a nutshell <p>What is Oslo all about? According to Microsoft's Burley Kawasaki at Architect Insight, Oslo is a new way to build connected applications where services are extended from client to cloud and models become the mainstream part of development. Oslo is not a product but a way of working. <a title="http://www.microsoft.com/soa/products/oslo.aspx" href="http://www.microsoft.com/soa/products/oslo.aspx">http://www.microsoft.com/soa/products/oslo.aspx</a>.</p> <p>Other things of interest from Architect Insight include the ConfigWeb sample (from Stock Trader) for configuring enterprise web applications (<a title="http://msdn.microsoft.com/en-us/netframework/bb499684.aspx" href="http://msdn.microsoft.com/en-us/netframework/bb499684.aspx">http://msdn.microsoft.com/en-us/netframework/bb499684.aspx</a>). The Internet Service bus and biztalk services (<a title="http://biztalk.net/Default.aspx" href="http://biztalk.net/Default.aspx">http://biztalk.net/Default.aspx</a>). </p> http://blogs.recneps.net/post/oslo-in-a-nutshell http://blogs.recneps.net/post/oslo-in-a-nutshell#comment http://blogs.recneps.net/post.aspx?id=d6154094-3dfb-43d8-9c46-231d1820eb0b Wed, 30 Apr 2008 10:10:01 +0000 OSLO Biztalk Microsoft Events Steve http://blogs.recneps.net/pingback.axd http://blogs.recneps.net/post.aspx?id=d6154094-3dfb-43d8-9c46-231d1820eb0b 9 http://blogs.recneps.net/trackback.axd?id=d6154094-3dfb-43d8-9c46-231d1820eb0b http://blogs.recneps.net/post/oslo-in-a-nutshell#comment http://blogs.recneps.net/syndication.axd?post=d6154094-3dfb-43d8-9c46-231d1820eb0b