Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Issue with Message copying
- This topic has 5 replies, 1 voice, and was last updated 9 years, 2 months ago by
community-content.
-
AuthorPosts
-
-
July 24, 2008 at 1:06 PM #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?
-
July 25, 2008 at 5:02 AM #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.
-
July 25, 2008 at 6:08 AM #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”.
-
July 25, 2008 at 8:32 AM #20238
are you doing this in a transformation/map or what code are you using?
-
July 25, 2008 at 12:55 PM #20244
I am using Message Assignment shape and using xmlDocument object to modify contents of msg2
-
July 28, 2008 at 7:39 AM #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();
-
-
-
-
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.