Issue with Message copying

Home Page Forums BizTalk 2004 – BizTalk 2010 Issue with Message copying

Viewing 1 reply thread
  • Author
    Posts
    • #20228

      I have a xml message Msg1 which has around 1000 elements in it. I have to create an xml message(orderReq) which has exactly two children which are of same type as Msg1. First child should be same as Msg1. Second child is same as Msg1 but few of it’s values modified. To create the second child, I am first copying Msg1 to another message Msg2 (of same type) and then modifying the values of Msg2. After creating Msg2, I am mapping Msg1 and Msg2 to the children of orderReq.

      Suprisingly, the elements I updated in Msg2 are also getting updated in Msg1. Can any one please tell me how can I modify the values in Msg2 without the values of original message(Msg1) getting modified?

    • #20232

      Sidhu,

      Are you creating both msg1 and msg2 in the same message construct shape? I would suggest that you create msg1 in one construct shape and then msg2 in another construct shape – messages are immutable (i.e. they can’t be changed) once they leave the Message Construct shape.

      HTH, Nick.

      • #20235

        I am not creating msg1. I am receiving it from a wcf service. I am only constructing msg2 and my construct shape also has only msg2 selected as “Messages Constructed”. 

        • #20238

           are you doing this in a transformation/map or what code are you using?

          • #20244

             I am using Message Assignment shape and using xmlDocument object to modify contents of msg2

            • #20249

               It’s how .NET references work with an XmlDocument.  You might want to include your code, but the problem is probably because the XmlDocument is pointing to your first message, then you change the XmlDocument, the first message is now changed.  To avoid this, create a new instance of a second XmlDocument (actually code: xmlDoc2 = new System.Xml.XmlDocument();

               

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