locked
Xml Validator doesn't work In Receive Pipeline RRS feed

  • Question

  • Hi, I have dropped Xml Validator in Decode stage of a receive pipeline. And Added XSD1 as document schema.

    and I have added my custom pipeline component to disassemble stage.

    My intention is, first validate message with xsd and throw error if it is not compliant. And only valid xml will be passed to my custom pipeline component for disassemble purpose.

    For Example: If my XSD1 allows : <Invoice Id="1"><Items><Item Id="I1" /><Item Id="I2" /></Items></Invoice>

    1. If I drop this xml as it is, it allows (Which is expected)

    2. If I add some invalid element or rename any element in this xml it throws error (As Expected). 

    3. If I drop this xml <abc><xyz /> </abc>, it succeeds to next stage. Which shouldn't. B'coz this xml is unknown type.

    In my case, even though the file I dropped has an xml which is not compliant to XSD1, it is coming to disassembler custom pipeline component.

    To give more details about my XSD:

    1. I don't have any XS:Any elements.

    2. I have imported XSD2 in XSD1 as a unbounded document.

    3. It is not an envelop.

    4. I already validated instances which are compliant and non-compliant documents against this XSD. It throws error for invalid xml instance.

     

    Thank you in Advance.


    Thanks - Venky Gundlapally

    Wednesday, September 7, 2011 7:08 PM

Answers

  • Venky,

    You can surely check this up with MS support and get a word from them. It should ideally not happen as the XML validator should validate with the specified schema and raise the error.


    Cheers,
    Bali
    MCTS: BizTalk Server 2010,BizTalk Server 2006 and WCF
    Blog: http://dpsbali-biztalkweblog.blogspot.com
    -----------------------------------------------------
    Mark As Answer or Vote As Helpful if this helps.
    Friday, September 9, 2011 2:26 PM

All replies

  • Venu,

     

    You do not have to specifically use the xml validator. If your physical receive location in biztalk admin console has Xmlreceive pipeline as the receive pipeline, and if it is bound to a logical port of an orchestration whose activate receive shape is bound to a message type. Then the messages that do not conform to the schema fail at the port. Just enable routing for failed messages on the receive port by clicking on the check box that says 'Enable routing for failed messages'. You'll see failed messages in the message box.

    Hope this helps. 


    Regards, Pa445
    Wednesday, September 7, 2011 8:31 PM
  • I am not using XmlReceive pipeline. I am using  a receive pipeline of my own, which has "XmlValidator" in DECODE stage and my CUSTOM pipeline component in DISASSEMBLE stage. 


    Thanks - Venky Gundlapally
    Wednesday, September 7, 2011 8:39 PM
  • I have never tried to use XmlValidator before the message has been Disassemble, the XmlValidator is typically placed after the Validate phase of the receive pipeline, its goal is to run the full xml validation on the message after the disassembler has determined the target namespace and root node so the validator can find the deployed message schema.
    Bill Chesnut | BizTalk Server MVP | Mexia Consulting | Melbourne Australia
    http://www.biztalkbill.com
    Please indicate "Mark as Answer" if this post has answered the question.
    Wednesday, September 7, 2011 9:02 PM
  • Bill,

    My custom Disassemble component is a critical and costly process. I don't want my custom disassemble component even invoke if the incoming xml is not compliant to the SCHEMA. 

    Moreover, Xml Validator can be used in any stage except Disassemble component. So, it is enabled for us for a specific purpose.

    Thank you

    Venky


    Thanks - Venky Gundlapally
    Wednesday, September 7, 2011 9:15 PM
  • Hi,

    Just did a small test, and the XML validator works like charm in the decode stage of a receive pipeline I created.

    Following are the few errors for which it suspends the message.

    URI: "D:\Workspace\Bali\SampleXML\Inbound\*.xml" Reason: The 'Number' element has an invalid value according to its data type.  

    URI: "D:\Workspace\Bali\SampleXML\Inbound\*.xml" Reason: The element 'XMLSample' in namespace 'http://SampleXML.XMLSample' has invalid child element 'FirstNam'. List of possible elements expected: 'FirstName'.  
    URI: "D:\Workspace\Bali\SampleXML\Inbound\*.xml" Reason: The 'http://SampleXML.XMLSample:XMLSampl' element is not declared.  
    Not sure what are you trying to validate for which it's not throwing the error in validation and suspending the message. Can you give an example.


    Cheers,
    Bali
    MCTS: BizTalk Server 2010,BizTalk Server 2006 and WCF
    Blog: http://dpsbali-biztalkweblog.blogspot.com
    -----------------------------------------------------
    Mark As Answer or Vote As Helpful if this helps.
    • Proposed as answer by DPS Bali Thursday, September 8, 2011 9:27 AM
    Thursday, September 8, 2011 6:08 AM
  • Hi DPS,

    If you drop the xml of XSD which you are validating it validates. But just drop the xml <abc><xyz/></abc> and see. It simply accepts and sends it to next stage.

    Xml Validator is validating only the XML which is compliant to XSD1 (in my case). Means if the root element matches, after that any issue in data it validates. But, If you drop just an xml which is not really make any sense to the application. It simply accepts.

    I hope, you got what I was asking. I will update my question again in detail.

    Thank you

     


    Thanks - Venky Gundlapally
    Thursday, September 8, 2011 1:18 PM
  • Hi DPS,

    In your case try with xml <abc><xyz /></abc> and let me know the result.

    Thank you for your time.

    Venky


    Thanks - Venky Gundlapally
    Thursday, September 8, 2011 2:48 PM
  • Hi Venky,

    Just that you understand this correctly. If you put a XML validator component that will only validate an XML it is not equivalent to an XML dissembler which will actually parse the XML. So to add to the solution I gave in the previous post, the <abc></xyz><abc/> file does not flow through the pipeline. 

    Following is the error message

    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.

    I think what you are missing in the custom disassemble component is the functionality that we get in the out-of-box XML dis-assembler. If this is not there after the decode stage (XML validator) the pipeline is just like a passthrough.

     Hope this clears the doubt. Lemme know if you have any further issues.

     


    Cheers,
    Bali
    MCTS: BizTalk Server 2010,BizTalk Server 2006 and WCF
    Blog: http://dpsbali-biztalkweblog.blogspot.com
    -----------------------------------------------------
    Mark As Answer or Vote As Helpful if this helps.
    Friday, September 9, 2011 5:14 AM
  • Hi Bali,

    In your case the error is raised by XML Disassembler component, not from Xml Validator. B'coz your Xml Disassembler component doesn't recognize "abc" xml, it couldn't parse it. 

    But why Xml Validator validated "<abc> <xyz /></abc>" and forwarded the same xml to next stage Xml Disassembler in your case?

    If Xml Validator validated "abc", it would throw "Invalid Element "abc" expected element is....etc.,"

    Thank you

    Venky


    Thanks - Venky Gundlapally
    Friday, September 9, 2011 1:38 PM
  • Venky,

    You can surely check this up with MS support and get a word from them. It should ideally not happen as the XML validator should validate with the specified schema and raise the error.


    Cheers,
    Bali
    MCTS: BizTalk Server 2010,BizTalk Server 2006 and WCF
    Blog: http://dpsbali-biztalkweblog.blogspot.com
    -----------------------------------------------------
    Mark As Answer or Vote As Helpful if this helps.
    Friday, September 9, 2011 2:26 PM
  • Yes. I am working on this to raise it as an issue to MS. Update you, If I have any info.
    Thanks - Venky Gundlapally
    Tuesday, October 11, 2011 1:31 PM