locked
System.Xml.XmlNode type exception RRS feed

  • Question

  • I am getting compilation error in orchestration. I have used scope for exception handling and error is coming due to System.Xml.XmlNode type variable usage.. please guide how to solve this issue. Thanks

    Compilation Error is following

    Error 11 a non-serializable object type 'System.Xml.XmlNode Node' can only be declared within an atomic scope or service PNC.odx

    when i change scope to atomic than it remove exception block.

    Wednesday, September 18, 2013 1:12 PM

Answers

  • Please do as follows:

    Remove variable xmlNodeVar

    Declare a variable called companyName with type string.

    Replace this statement

    xmlNodeVar = xmlDoc.SelectSingleNode("/*[local-name()='FirstMessage' and namespace-uri()='http://ABC.BizTalk.Schemas.FirstMessage']/*[local-name()='Batches' and namespace-uri()='']/*[local-name()='Batch' and namespace-uri()='']/*[local-name()='Records' and namespace-uri()='']/*[local-name()='Record' and namespace-uri()='']/*[local-name()='CompanyName' and namespace-uri()='']") 

    With

    companyName = xpath(<<your message name>>,"string(/*[local-name()='FirstMessage' and namespace-uri()='http://ABC.BizTalk.Schemas.FirstMessage']/*[local-name()='Batches' and namespace-uri()='']/*[local-name()='Batch' and namespace-uri()='']/*[local-name()='Records' and namespace-uri()='']/*[local-name()='Record' and namespace-uri()='']/*[local-name()='CompanyName' and namespace-uri()=''])")
    Please replace <<your message name>> with the message name from which you want to extract Company Name


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.


    • Edited by SAAkhlaq Wednesday, September 18, 2013 1:56 PM edit
    • Proposed as answer by Johns-305MVP, Moderator Wednesday, September 18, 2013 2:42 PM
    • Marked as answer by Pengzhen Song Wednesday, September 25, 2013 11:25 AM
    Wednesday, September 18, 2013 1:56 PM

All replies

  • Hameed,

    You are getting error because XmlNode is a non serialized object.

    If you want to use XmlNode you have to  use it inside an atomic scope. Can you please tell what exactly are you trying to do?

    can you please share the statement where you have used XmlNode?


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.

    Wednesday, September 18, 2013 1:36 PM
  • Thanks for response. I am using XmlNode because i need to access orchestration message xml element using xpath and i am using scope for handling orchestration level exceptions..

    Xpath queries is

    xmlNodeVar = xmlDoc.SelectSingleNode("/*[local-name()='FirstMessage' and namespace-uri()='http://ABC.BizTalk.Schemas.FirstMessage']/*[local-name()='Batches' and namespace-uri()='']/*[local-name()='Batch' and namespace-uri()='']/*[local-name()='Records' and namespace-uri()='']/*[local-name()='Record' and namespace-uri()='']/*[local-name()='CompanyName' and namespace-uri()='']") 

    i need to access CompanyName element value of orchestration message.

    Wednesday, September 18, 2013 1:47 PM
  • Please do as follows:

    Remove variable xmlNodeVar

    Declare a variable called companyName with type string.

    Replace this statement

    xmlNodeVar = xmlDoc.SelectSingleNode("/*[local-name()='FirstMessage' and namespace-uri()='http://ABC.BizTalk.Schemas.FirstMessage']/*[local-name()='Batches' and namespace-uri()='']/*[local-name()='Batch' and namespace-uri()='']/*[local-name()='Records' and namespace-uri()='']/*[local-name()='Record' and namespace-uri()='']/*[local-name()='CompanyName' and namespace-uri()='']") 

    With

    companyName = xpath(<<your message name>>,"string(/*[local-name()='FirstMessage' and namespace-uri()='http://ABC.BizTalk.Schemas.FirstMessage']/*[local-name()='Batches' and namespace-uri()='']/*[local-name()='Batch' and namespace-uri()='']/*[local-name()='Records' and namespace-uri()='']/*[local-name()='Record' and namespace-uri()='']/*[local-name()='CompanyName' and namespace-uri()=''])")
    Please replace <<your message name>> with the message name from which you want to extract Company Name


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.


    • Edited by SAAkhlaq Wednesday, September 18, 2013 1:56 PM edit
    • Proposed as answer by Johns-305MVP, Moderator Wednesday, September 18, 2013 2:42 PM
    • Marked as answer by Pengzhen Song Wednesday, September 25, 2013 11:25 AM
    Wednesday, September 18, 2013 1:56 PM