Friday Fact: Integration Account doesn’t support XML Nested Schemas for Schema Validation

For 2024, I have challenged my team to every Friday to publish a fact about the technologies we work on every day. The base rules will be:

  • This has to be an easy-to-read post.
  • The fact can be virtually everything: a tip, a best practice, a workaround, an opinion, a fact, a tool, and so on.

And this will be the first one! But before we start I feel I need to explain the featured image of this series of posts! For fun, I asked ChatGPT to generate a 16:9 picture with the following context:

  • Three male friends on a Friday night at a pub:
    • The first man with a beard is drinking beer (Luis Rigueira).
    • The second man is bald and has no beard. He is drinking wine. (me)
    • And the third man has glasses, he doesn’t have a beard, and he is drinking Coke soda. (Diogo Formosinho)

This was the end result:

Now, the fun part: by mistake, I misspelled beer and wrote bear – that is the reason for the bear in the picture if you are wondering :)… but we decided to call him “the traitor” (he knows who he is!!)

Now, to start this series of blog posts, I have selected this fact: if you need to perform an XML Schema validation using the Integration Account, please remember that the Integration Account doesn’t support nested schemas, at least yet! The beauty of Azure is that everything changes at a fast pace, and new features arrive almost every day.

The import element inside XML Schemas is used to add multiple schemas with different target namespaces to a document. This allows us, for example, to create common objects that are reused inside several schemas.

For example, this XML payload:

<ns0:Person xmlns:ns0="http://POC.ValidateInboundXMLMessages.Person">
  <FirstName>Sandro</FirstName>
  <LastName>Pereira</LastName>
  <DateOfBirth>1978-04-04</DateOfBirth>
  <ns1:Address xmlns:ns1="http://POC.ValidateInboundXMLMessages.Address">
    <Street>Porto</Street>
    <Number>1</Number>
  </ns1:Address>
</ns0:Person>

It has two objects: the Person and the Address. If we open the Person Schema, we realize that there is an importation for the Address Schema inside:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://POC.ValidateInboundXMLMessages.Person" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:ns0="http://POC.ValidateInboundXMLMessages.Address" targetNamespace="http://POC.ValidateInboundXMLMessages.Person" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:import schemaLocation=".\Address.xsd" namespace="http://POC.ValidateInboundXMLMessages.Address" />
  <xs:annotation>
    <xs:appinfo>
      <b:references>
        <b:reference targetNamespace="http://POC.ValidateInboundXMLMessages.Address" />
      </b:references>
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="Person">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="FirstName" type="xs:string" />
        <xs:element name="LastName" type="xs:string" />
        <xs:element name="DateOfBirth" type="xs:date" />
        <xs:element ref="ns0:Address" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

If you have this scenario in your hands, unfortunately, I have to tell you that the Integration Account doesn’t support it. And you will end up with the following error:

The provided schema content is not valid. If the schema has any references, please upload the referenced schemas to the Integration Account first. The compilation of schema failed with error: ‘The ‘http://POC.ValidateInboundXMLMessages.Address:Address’ element is not declared.’.

How can we fix this? Well, this is a subject for another blog post and not for a Friday Fact!

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 buy (or help me buy) my son a Star Wars Lego! 

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

turbo360

Back to Top