Search code examples
xmlxsdazure-logic-apps

Logic App Workflow - Flat File Encode error - Invalid Schema


I have a logic app workflow using a flat file encode step for an XML file. I have uploaded the XSD file to the Artifacts/Schema location for the Logic app. When I run the workflow I see the following error from the Flat File Encode step:

"No schema has the specified target namespace http://B3.Schemas.Invoices"

I have specified the target namespace in the XSD file so not sure why I am seeing this error?

XSD Schema (Stored in Logic App Artifacts/Schemas area):

<?xml version="1.0" encoding="UTF-8"?>
 <xs:schema xmlns:vs="http://B3.Schemas.Invoices" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://B3.Schemas.Invoices"  xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <xs:element name="Header">
     <xs:complexType>
      <xs:sequence>
        <xs:element name="processSendTime" type="xs:string"/>
         <xs:element name="processTarget" type="xs:string"/>
         <xs:element name="processType" type="xs:string"/>
        <xs:element name="processDescription" type="xs:string"/>
         <xs:element name="processLogID" type="xs:string"/>
        <xs:element name="fileSequenceID" type="xs:string"/>
         <xs:element name="processSource" type="xs:string"/>
      </xs:sequence>
    </xs:complexType>
   </xs:element>
</xs:schema>

Test file example:

<?xml version="1.0" encoding="utf-8"?>
 <vs:Invoices xmlns:vs="http://B3.Schemas.Invoices">
   <Header>
     <processSendTime>2024-04-09T22:00:05</processSendTime>
     <processTarget></processTarget>
     <processType></processType>
     <processDescription></processDescription>
     <processLogID>90906422</processLogID>
     <fileSequenceID>85707</fileSequenceID>
     <processSource>Biblio3</processSource>
 </Header>
</vs:Invoices>

I have tried testing my Logic App workflow with the above file and seeing the error as described.


Solution

  • Correct your XSD schema as below to get the expected response.

    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:vs="http://B3.Schemas.Invoices" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://B3.Schemas.Invoices" xmlns:xs="http://www.w3.org/2001/XMLSchema">
       <xs:element name="Invoices">
         <xs:complexType>
           <xs:sequence>
             <xs:element name="Header">
               <xs:complexType>
                 <xs:sequence>
                   <xs:element name="processSendTime" type="xs:string"/>
                   <xs:element name="processTarget" type="xs:string"/>
                   <xs:element name="processType" type="xs:string"/>
                   <xs:element name="processDescription" type="xs:string"/>
                   <xs:element name="processLogID" type="xs:string"/>
                   <xs:element name="fileSequenceID" type="xs:string"/>
                   <xs:element name="processSource" type="xs:string"/>
                 </xs:sequence>
               </xs:complexType>
             </xs:element>
           </xs:sequence>
         </xs:complexType>
       </xs:element>
    </xs:schema>
    

    I am able to get the expected response.

    enter image description here

    enter image description here