Friday, September 9, 2011

BizTalk XML validator in Decode Stage of the pipeline component

Was a query in the forums about the requirement of using the XML validator component in the decode stage of the receive pipeline component. So thought would do a small test. The XML validator is designed to work in any stage of the pipeline component, except the disassemble and assemble stages. The XML Validator component validates the message against the specified schema or schemas, and if the message does not conform to these schemas, the component raises an error and Messaging Engine places the message in the suspended queue. However, the XML validator does not disassemble the message and if it is used alone in the pipeline component decode stage, the pipeline component might end up being a pass through. To follow up the XML validator in the decode stage we need to have the XML Disassembler component in disassemble stage to actually parse the XML
Fig. 1 is the receive pipeline configuration.
Fig.1 Receive pipeline component

To check the XML validator, tried three failure cases.


  • Different XML


A message received by adapter "FILE" on receive location "RcvLocSampleXML" with URI "D:\Workspace\Bali\SampleXML\Inbound\*.xml" is suspended. 

 Error details: There was a failure executing the receive pipeline: "SampleXML.SampleXMlRcvPipe, SampleXML, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5a23cf5fc2674b2a" Source: "Pipeline " Receive Port: "RcvPortSampleXML" URI: "D:\Workspace\Bali\SampleXML\Inbound\*.xml" Reason: The element 'XMLSample' in namespace 'http://SandboxSchemas.XMLSample' has invalid child element 'FirstNam'. List of possible elements expected: 'FirstName'.  
  • Incorrect data type in one of the elements.
A message received by adapter "FILE" on receive location "RcvLocSampleXML" with URI "D:\Workspace\Bali\SampleXML\Inbound\*.xml" is suspended. 
 Error details: There was a failure executing the receive pipeline: "SampleXML.SampleXMlRcvPipe, SampleXML, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5a23cf5fc2674b2a" Source: "Pipeline " Receive Port: "RcvPortSampleXML" URI: "D:\Workspace\Bali\SampleXML\Inbound\*.xml" Reason: The 'Number' element has an invalid value according to its data type.  

  • Different XML Namespace
A message received by adapter "FILE" on receive location "RcvLocSampleXML" with URI "D:\Workspace\Bali\SampleXML\Inbound\*.xml" is suspended. 
 Error details: There was a failure executing the receive pipeline: "SampleXML.SampleXMlRcvPipe, SampleXML, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5a23cf5fc2674b2a" Source: "Pipeline " Receive Port: "RcvPortSampleXML" URI: "D:\Workspace\Bali\SampleXML\Inbound\*.xml" Reason: The 'http://SandboxSchemas.XMLSample:XMLSampl' element is not declared.  



  • A valid xml but not conforming to the schema.
A message received by adapter "FILE" on receive location "RcvLocSampleXML" with URI "D:\Workspace\Bali\SampleXML\Inbound\*.xml" is suspended. 
 Error details: There was a failure executing the receive pipeline: "SampleXML.SampleXMlRcvPipe, SampleXML, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5a23cf5fc2674b2a" Source: "XML disassembler" Receive Port: "RcvPortSampleXML" URI: "D:\Workspace\Bali\SampleXML\Inbound\*.xml" Reason: No Disassemble stage components can recognize the data.   

No comments:

Post a Comment