Saturday, January 7, 2017

Azure BizTalk FlatFile Decoder

Recently one of my new probable customer wanted to convert CSV file to Xml.
So I recommended Biztalk but they dont have an On Premise Biztalk Server and dont plan one.
So I recommended using BizTalk in Auzre as a Service the so called "Enterprise Integration".
The only catch was I never worked with it so had no idea what it could offer.
So here we start looking into what challenges I faced.
I went through some good articles from Richard and Steve which pretty much gave me a head start but could not achieve what they achieved in the blog...thats why I am not an MVP ;) .

So kepeing things short I will just show you few do's and dont's which you should be careful with.
So the scenario here is to first just convert a flat file to Xml.

1. First thing is to download the "Microsoft Azure Logic Apps Enterprise Integration Tools for Visual Studio 2015 2.0"

Here in Visual Studio -> New Project it looks similar to BizTalk but with only 3 options when you try to "Add New Items" after creating the project.

As a BizTalker one clearly thinks of the Flat File wizard....yes we have it here.
The Flat File Schema is actually the Flat File Wizard.
Sandro has explained it better here

So i did next is created the Flat File Schema called EmpCsv.xsd

If you want to can create the map and map the FF Schema to Xml schema also.
But I will not show the mapping in Azure in this blog post.

Very important

  1. Dont try to validate the FlatFile Schema.
  2. Dont try to Test the map using Flatfile csv input.

It fails as its buggy. 
So if you want to test the map you can test it using Flat file Xml as an input.
So how to get the Xml from the Schema?
Thats what I used 1 complete evening finding out.

So lets assume everything works and we are ready to deploy to Azure.
Remember I have not tested the map...I dont know if the Flat file validates against the Schema.

So now its Azure time.
1.Here we need to first create an "Integration Account" where we will add our Schemas and Map.

2. We will add the Schemas and maps to the Integration Account

3. Now we will create a new blank "Enterprise Integration" Logic App.

4. Associate the "Integration Account" to created Logic App.
You can go to properties of the Logic App created and link it.

5. Now we start creating the Logic App in the Logic App Designer.
Add the Request Shape.

In the Request shape only the important thing is the makred in yellow(URL). Need to copy it later on when we want to send the flatfile for testing.
Nothing else need to be done here in body. Leave it blank.

Click on the Next Step -> "Add an Action" and Add the "Flat file Decoder" Component.
We need to fill 2 boxes here
1. Content
    Click on the Content textbox it should popup the option as to use body(Output from the Request Step) as input .
2. Schema Name:
If the Integration Account is should show up the Schemas we added to the Integration Account.
Select the FlatFile Schema which we want to convert to Xml(Think of it as Flat file pipeline decoder stage: Select Schema and done converted to Xml).

Click on the next Step and Add "Response" Shape which will return us the Flatfile in XML format.
We need to fill only the Body with output from Flat File Decoder.

This is how it should look like.
Copy the URL from Request shape.

2. Testing
Now we are ready to test.
Click "Run" on  the Logic App Menu to start the App.
It will show some error in the FlatFile decoder but dont worry it wont cause any problem.

You need to get a testing tool form here

I used Chrome addon.
So you need to paste the URL
Select "Post"
Click on "Body"
Click on "raw"
Paste the Flaltfile in the TextBox and Click Send.
The Response will be shown below.

So we converted the FlatFile to Xml.
Finally I have uploaded the Schemas/map/Test file out here.
Just download it and test it using Azure.

In the next Post I will show how to map this FlatFile to a Xml file and return it.

1 comment:

  1. it’s really nice and meanful. it’s really cool blog. Linking is very useful have really helped lots of people who visit blog and provide them usefull information.

    Biztalk Online Training Hyderabad