For novice BizTalk developers such simple task like creating messages in BizTalk orchestration may become cumbersome. This is what I’ve learned so far :)
Please remember that messages are immutable in BizTalk.
Ways to create message in BizTalk
- BizTalk maps. Used when you have source message and you want to transform it to a different type. This is done inside pipelines.
- Assignment in Biztalk Expression Editor
Message_2(*) = Message_1(*);
- XPath query in BizTalk Expression Editor
Message_2.Address = xpath(Message_1,"/*[local-name()='CustomerAddress']");
- Create XmlDocument in BizTalk Expression Editor
xmlMessage = new System.Xml.XmlDocument();
xmlDocMessage.LoadXml("<customer><address>ABC</address></customer>");
Message_2 = xmlMessage
- Using C# helper class in BizTalk Expression Editor
First create classes with XSD.exe (xsd.exe /classes /namespace:MyNamespace schema.xsd
). Then create a helper class and invoke it inside BizTalk Expression Editor
Message_2 = helper.CreateMessage_2();