Extarcting data from Xml string in orchestration

Home Page Forums BizTalk 2004 – BizTalk 2010 Extarcting data from Xml string in orchestration

Viewing 1 reply thread
  • Author
    Posts
    • #20673

       

      Hi, I have this problem and I’m new to BizTalk, and looking for help here..

       I have an expression shape inside my orchestration that calls a .net method which returns an Xml string.  I need to get the number of occurrences of a specific field in this Xml, so I created an Xml document in the orchestration and fetched a NodeList for the field, and then got the Count property of it. On compile I got the error : “a non-serializable object type ‘System.Xml.XmlNodeList myXmlNodeList’ can only be declared within an atomic scope or service”. Here is the code

      myXmlDoc.LoadXml(xmlStr);

      myXmlNodeList =  myXmlDoc.SelectNodes(“//node”);

      intCount = myXmlNodeList.Count;

      Actually I’m not sure if this is the right way or the best practice to do it in the first place..!

       

    • #20675

       Hi

      Yeah that’s true.

      All object instances that your orchestration refers to directly or indirectly (as through other objects) must be serializable for your orchestration state to be persisted.

      So there are two solutions for that

      1.You can have a nonserializable object declared inside an atomic transaction. You can do this because atomic scopes do not contain persistence points.

      2. You can serialize your own classes if you mark them with [Serializable] attribute

      Best reagdrs,

      Nandika

       

      • #20679

         Thank Nandiaka for ur reply..

        I also found another quick approch to get to the field, using xpath:

        intCount = System.Convert.ToInt32(xpath(BiztalkMsg, “count(//nodeName)”));

         

        Regards,

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