Friday, 19 June 2015

Hello World-Azure Logic Apps -Basic XML Transformation


This Article provides information on how to create Azure logic app for xml transformation.

This app will pick up the source xml from on premise directory, convert xml to another format and put that xml into another on premise directory.

For me that was the first step, but in a real BizTalk scenario there at least has to be one map! My scenario is to read from my local laptop ‘inbox’ folder, transform the message and write to the same laptop to an ‘output’ folder.

Components Required

Below are the software and components required for creating the Sample

  •  Visual Studio 2012.
  • Windows Azure BizTalk Services SD
  • Azure Subscription.

Step by Step

  •  Create Service Bus namespace on Azure portal.
  •  Create and configure File connector API to connect local on premise directory with Azure.
  •  Create Schema and Map required to transform XML format.
  • Create BizTalk Transformation API and upload created map in API
  •  Test Azure Logical Transformation App.

Create ServiceBus namespace

We need to create Azure Service Bus namespaces, since it’s required for configuring file connector. File connector under the hood uses the Service Bus Relay technology to connect to the on premise environment.
Service Bus namespace can be created from the old portal.

 You can copy the connection string of the service bus from the connection information, which is required for configuring the File connector.


 Create and Configure File connector for Directory

Create File Connector to connect with on premise local directory.

Goto Marketplace->Api Apps->File Connector.
Name: SharedDriveAFileConnector.
Roor Folder: D:\Azure\ShareDriveA
Service Bus Connection String: copied from the Service bus connection information.

Once you click the create button, it will take about a minute to provision the File connector (API App), before you can use it in your solution (Azure Logic App). You need to repeat the above steps to configure the second File connector to the destination location,
Goto Marketplace->Api Apps->File Connector.
Name: SharedDriveBFileConnector.
Roor Folder: D:\Azure\ShareDriveB
Service Bus Connection String: copied from the Service bus connection information.


As you can notice there is a warning sign in the blade showing “Hybrid Connection – On Premise Setup Incomplete”, just click on that box, which will open up “Hybrid Connection” blade. You will see a link labelled ON-PREMISES HYBRID CONNECTION MANAGER “Download and configure”, clicking on that will download the on-premise agent file. Copy that file to the server where you’ll have your folder location, and start installing it (internet connection is required of course), the installer will ask for service bus relay connection string as shown below

Once you provide that information and completed the installation procedure, leave few seconds and check back on the File Connector blade, it should now show the connection successfully established as shown below.

Create BizTalk Transformation API

We have to transform one XML to another so we will use BizTalk Transform API and use into our logic app.
Again go to the Azure Marketplace, search for “BizTalk Transform service” and create a new instance. Steps for creating the BizTalk Transform service is straight forward and doesn’t need any hybrid connection step up.

Once API created we can add map into the service.

Create BizTalk Schema and Map

Create the BizTalk Schema and Map in Visual Studio 2012.
1.       Create Input Schema 

2.     Create Output Schema 

3.       Create Map for transformation.

4.       Upload Map into the BizTalk Transformation Service API App.

Create Azure Logic App

Goto Azure portal
New-> Logic Apps->Logic App->

Name: AzureTransformationApp
Click on Trigger and Action 

Configure BizTalk Transformation Service.
Configure File Connector.

Test the Application

1: Drop the input file at source location.
2: Check the target location


<ns0:PO xmlns:ns0="http://HelloWorld.POSchema">


<?xml version="1.0" encoding="utf-8"?>
<ns1:Invoice xmlns:ns0="http://HelloWorld.POSchema" xmlns:ns1="http://HelloWorld.InvoiceSchema">

You can check the status of runs from the dashboard.

Possible Error

How to Check Errors in Azure Logic Apps:

Go to Logic App.
Click on Trigger History 

Error “duplicate collection entry”:

Error Statement: Cannot add duplicate collection entry of type 'mimeMap' with unique key attribute 'fileExtension' set to '.json'
Solution: Remove the mimeMap tag from IIS service which was created for File Connector

      <mimeMap fileExtension=".json" mimeType="application/json" />

Error “Access Denied”:

Check access of folder location.

No comments:

Post a Comment