BizTalk validating invalid xml with Xml Receive Pipeline even when ValidateDocument Property is set to false
Hi I have an application that sometimes receives invalid XML, Here I have used the Default XmlReceive Pipeline with ValidateDocument property set to false. But while processing Xml's of these types I am getting an error of

A message received by adapter "FILE" on receive location "" with URI "" is suspended.
 Error details: There was a failure executing the receive pipeline: "Microsoft.BizTalk.DefaultPipelines.XMLReceive, Microsoft.BizTalk.DefaultPipelines, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Source: "Pipeline " Receive Port: "InValidXmlInPrt" URI: "" Reason: An error occurred when parsing the incoming document: "The 'ns0:RootRecord' start tag on line 1 position 2 does not match the end tag of 'Re'. Line 2, position 5.".       

Why is Xml Receive pipeline validating the well formedness of the XML eventhough the required property is set to false

My requirement i am doing the custom XML validation in the Orchestration, hence BizTalk should pass the pipeline stage without throwing any error.
How do i acheive this, what configuration needs to be set.

Schema -
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://InvalidXmlHandlingCheck.InvalidXmlINSchema"
xmlns:b="http://schemas.microsoft.com/BizTalk/2003"
targetNamespace="http://InvalidXmlHandlingCheck.InvalidXmlINSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="RootRecord">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Record">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="Field1" type="xs:string" />
              <xs:element name="Field2" type="xs:string" />
              <xs:element name="Field3" type="xs:string" />
              <xs:element name="Field4" type="xs:string" />
              <xs:element name="Field5" type="xs:string" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

XML Beign Sent - (Here an invalid XML is being sent)

<ns0:RootRecord
xmlns:ns0="http://InvalidXmlHandlingCheck.InvalidXmlINSchema">
  </Re
    <Field3>Field3_0</Field3>
    <Field4>Field4_0</Field4>
    <Field5>Field5_0</Field5>
  </Record>
</ns0:RootRecord>
April 19th, 2015 1:04am

Hi Praveen,

Default XMLReceive Pipeline will not allow you to pass Invalid XML even if you set ValidateDocument Property to False.

ValidateDocument Property if set to True validates your XML documents against a schema and setting it to False doesnt mean it will allow you to pass Invalid XML.

How to proceed:

1) You have to use Pass-Through Pipeline.

2) If you want your Orchestration to catch everything from a Receive Port, even invalid stuff, you need to specify your input message type in the Orchestration as XMLDocument.

This will cause the Orchestration to subscribe to:

ReceivePortID == [Port ID]

Be aware though, although you can pass invalid XML into this XMLDocument, you cannot use it for anything, expect passing it to an external assembly (as inside of BizTalk always expects XML).

Rachit

Free Windows Admin Tool Kit Click here and download it now
April 19th, 2015 1:57am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics