Wednesday, April 05, 2017

Deconstructing my GIB2017 Demo

Last Saturday, I participated as speaker at Global Integration Bootcamp 2017 at Madrid. You can find the slides of the event at Kabel's Blog.

In the event, I did a demo about Logic Apps and Enterprise Integration Pack. The key features that I wanted to demonstrate was:

1) Create Service Bus and Queues using Service Bus Explorer:

The first step of my demo, was to trigger my Logic App when new messages arrive to a Queue on Azure Service Bus.

For that I create a Service Bus namespace through the Azure Portal:

And then I add two queues using Service Bus Explorer. Service Bus Explorer is a tool to manage and test the entities contained in an Azure Service Bus namespace. Here you can download it.

We need a connection string of the Service Bus namespace, that we can get from Azure Portal:

1) Go to Service Bus namespace object
2) Select Shared Access Policies
3) Select RootManageSharedAccessKey

In Service Bus Explorer, File > Connect > Enter connection string ..., paste your connection string and click on OK.

Now you can add queues, topics and read/write test messages on those queues and topics.

2) Create Logic App, an Integration Account and associate them:

To associate an Integration Account and a Logic App, first we need to create a new Logic App and then, create a new Integration Account in the same location.

The last step is in the Logic App properties, select Settings > Integration Account and assign our Integration Account.

3) Validating XML and Mapping:

If we need validate XML and do some mappings, we need:

- Visual Studio 2015 to create maps and schemas
- Microsoft Azure Logic Apps Enterprise Integration Tools for Visual Studio 2015 2.0

Inside Visual Studio, we design our schemas and maps in the new Logic Apps > Integration Account project type:

Then we have to upload our files to the Integration Account on the Azure Portal.

The schemas can be uploaded directly to the Integration Account in the Azure Portal, but the maps needs to be compiled, because we have to uploaded only the generated xslt files.

After add our schemas and maps, we can use them on our Logic App with the XML Validation and Transform XML connectors.

4) Debatching XML:

Debatching XML is very simple, we need to add a For Each inside our Logic App and in the Select an output from previous steps, insert an xpath of the node to debatch with the xpath and xml functions. For example:

@xpath(xml(body('Transform_CreateOrderRequest_To_CreateOrder')), '/*[local-name()=\"CreateOrder\" and namespace-uri()=\"\"]/*[local-name()=\"Order\" and namespace-uri()=\"\"]')

Inside the For Each, the content of each item is accessed with item(). For example, get a json equivalent of the generated XML:


5) Error Validating XML:

First, we have to put our Validation XML inside an Scope.

Then, this is the weird part, because at this moment we have to implement this in the code of the Logic App and not in the designer, we have to add an action that run after our scope and only when it failed, something like this:

"Filter_Errors": {
                "inputs": {
                    "from": "@result('Scope_Validation_Request')",
                    "where": "@equals(item()['status'], 'Failed')"
                "runAfter": {
                    "Scope_Validation_Request": [
                "type": "Query"


....and this is my little "deconstruction" of my demo :-)

No comments: