Friday Fact: XML to JSON Conversion in API Management and Logic Apps have different behaviors

Friday Fact: XML to JSON Conversion in API Management and Logic Apps have different behaviors

I don’t know the reason why two products from the same family – Azure Integration Services – have completely different behaviors while converting XML to JSON, but that is the current reality. It is a fact! API Management and Logic Apps have different behaviors while applying this conversion, and that is one of the main reasons that I decided to create an Azure Function to convert XML into JSON, to keep the consistency between these two products.

While using API Management, we can use the xml-to-json policy to convert a request or response body from XML to JSON. However, when dealing with XML namespaces and prefixes, which is quite normal when working with XML messages, the policy has, in my opinion, a strange conversion behavior:

  • It converts the prefixes that in XML are represented by prefix:MyField into prefix$MyField. In order words, it replaces the colon character (:) with the dollar character ($).

Let’s take this XML sample in order for you to see the upcome result of that xml-to-json policy:

Book-Signing Event Convert it to JSON

The result will be:

{
    "section": {
        "@xmlns": "http://www.test.com/events",
        "@xmlns$bk": "urn:loc.gov:books",
        "@xmlns$pi": "urn:personalInformation",
        "@xmlns$isbn": "urn:ISBN:0-999-99999-9",
        "title": "Book-Signing Event",
        "signing": {
            "bk$author": {
                "@pi$title": "Mr",
                "@pi$name": "My Name"
            },
            "book": {
                "@bk$title": "How cool is XML",
                "@isbn$number": "9999999999"
            },
            "comment": {
                "@xmlns": "",
                "#text": "Convert it to JSON"
            }
        }
    }
}

I think this behavior is strange and incorrect.

Now, if we take the same XML payload and try to convert it inside Logic Apps using the json() expression that returns the JSON type value or object for a string or XML. In this case, using, for example, the following expression:

  • json(xml(triggerBody()))

The result will be:

{
    "section": {
        "@xmlns": "http://www.test.com/events",
        "@xmlns:bk": "urn:loc.gov:books",
        "@xmlns:pi": "urn:personalInformation",
        "@xmlns:isbn": "urn:ISBN:0-999-99999-9",
        "title": "Book-Signing Event",
        "signing": {
            "bk:author": {
                "@pi:title": "Mr",
                "@pi:name": "My Name"
            },
            "book": {
                "@bk:title": "How cool is XML",
                "@isbn:number": "9999999999"
            },
            "comment": {
                "@xmlns": "",
                "#text": "Convert it to JSON"
            }
        }
    }
}

In this case, the json() expression does not replace the colon character (:) with the dollar character ($) in the prefixes. It’s maintaining, which I think is the correct behavior.

To lazy to read? We’ve got you covered! Check out our video version of this content!

Hope you find this helpful! So, if you liked the content or found it useful and want to help me write more, you can help us buy a Star Wars Lego for Sandro’s son! 

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc.

He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.
View all posts by Sandro Pereira

Friday Fact: Is BizTalk Server dead? Hell, no!

Friday Fact: Is BizTalk Server dead? Hell, no!

This will probably be one of the most polemic Friday Facts, but this topic brings miss feelings depending on who you are. On the other hand, I work in both worlds, enjoy this mix of capabilities, and always try to tell the real picture to my clients. But I will never say something untrue simply because it is neither polite nor correct. We already live in a work of too much fake news! Let’s try to avoid a new “old” one.

No, BizTalk Server is not dead!

While there has been a shift towards cloud-based integration solutions, such as Azure Logic Apps and Azure Service Bus, BizTalk Server continues to be actively used and maintained by organizations worldwide.

BizTalk Server remains a reliable and mature integration platform that offers a wide range of capabilities for connecting systems, orchestrating business processes, and managing enterprise-level integrations. Many organizations still rely on BizTalk Server for complex integration requirements, especially in industries with prevalent legacy systems and on-premises integrations.

As with everything in life, at some point, everything will have an end, but don’t try to bury something that is still very much alive!

This rumor that the BizTalk Server is dead is made mainly by:

  • Other Microsoft competitors. Those who want to increase their business and gain opportunities with customers who are unduly influenced not to use BizTalk Server or migrate BizTalk Server to other middleware products.
  • Consultant companies that don’t have, never had, or have minimal technical expertise in BizTalk Server and take this opportunity to use Azure Service instead or other technologies.

All this is combined with Microsoft’s marketing strategy, which clearly has Azure as its primary target, which is OK. All vendors these days are cloud-driven.

The first time I heard BizTalk Server was dead was approximately in 2006! Since then, many new products/services have been the future of integration and BizTalk Server replacements. Where are they?

I can give some samples:

  • Project OSLO, status: dead.
  • Windows Workflow foundation, status: dead.
  • Azure BizTalk Services (aka Windows Azure Service Bus EAI and EDI Labs), status: dead.
  • Integration Service Environment (ISE) in Azure Logic Apps, status: in-life support – On August 31, 2024, the ISE resource will retire due to its dependency on Azure Cloud Services (classic), which retires at the same time.

Ok, but it is the latest product version, and Microsoft is not investing in it!

First, the current version of BizTalk Server has Mainstream support for more than 4 years! Maybe more than many products that you know!

Second, there has yet to be an official announcement from Microsoft that this is the last version of the product! Which there isn’t!

Third, I don’t see any investment from Microsoft in Logic App Consumption these last years; does it mean Logic App Consumption is dead? Hell, NO! It implies they heavily invest in Logic App Standard to close the missing feature gaps.

The time of products having a long roadmap that companies could rely on is over; get used to it. But that doesn’t mean that products are dead or deprecated.

The future is the cloud, and the cloud is where Microsoft is investing, with new features released almost daily. Microsoft has provided a clear path for this migration to customers who want to take this approach or if it makes sense to move. But Microsoft is not forcing them to shift away from BizTalk Server. The effort required to make this migration journey will be reduced as the capabilities of Microsoft Azure increases.

And as I wrote in my book, maybe, or maybe not, the core issue is that BizTalk Server has already survived a decade longer than people intended or expected. In 2010, the word was clearly shared that the “End of BizTalk Server” was nigh, and the community should prepare for this event. Here we stand in 2024 with no clear guidance defining the end of BizTalk Server and still being a very valuable product… get used to it!

BizTalk Server boasts nearly 24 years of resilience. Despite numerous attempts to bring it down, it has proven to be an unstoppable force. The secret lies in the fact that BizTalk Server is nothing short of a powerhouse! In the spirit of T-800, also known as The Terminator, it echoes the iconic words:

I’ll be back

To lazy to read? We’ve got you covered! Check out our video version of this content!

Hope you find this helpful! So, if you liked the content or found it useful and want to help me write more, you can help us buy a Star Wars Lego for Sandro’s son! 

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc.

He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.
View all posts by Sandro Pereira