Checking XmlDocument for Well-Formedness

Home Page Forums BizTalk 2004 – BizTalk 2010 Checking XmlDocument for Well-Formedness

Viewing 1 reply thread
  • Author
    Posts
    • #16428

      Hi All,

      In a orchestration for handling message validation errors, I use a Receive port with Direct binding, and it recieves a message of type XmlDocument. Since it is Direct binding the well formed ness of the document is not checked and whatever there is comes into the orchestration. In the orchestration I want to check if the document is well formed or not, if it is I return the message body with the response message to the client, so that he can check where the message went wrong. Other wise if the document is not well formed, I just tell him that your xml was not valid.

      The problem is I cant use try catch in Expression shape to check for the well formedness of the xmldocument. Please tell me a way using which I can check its well formedness in the orchestration.

       

      Regards,

      Sajid. 

       

       

    • #16437

      It depends on how you are loading the XmlDocument object…

      LoadXml does not perform validation, and Load would require you to utilize a XmlValidatingReader and ValidationEventHandler for validation…you could consider using either method within a Pipeline Component and manage any exceptions at the disassemble stage before it hits your port.

      MSDN Article

      My $.02, but I'm sure the actual Guru's may have a solution as well.

      -Rich

      • #16440

        You can create a try/catch block in the orchestration using a scope.

        In an expression shape in the scope

        xmlDocVariable = incomingMessage;

        Add an exception handler to the scope to catch System.Xml.XmlException 

         

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.