Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are several options when wanting to create a new instance of a message in a BizTalk orchestration.</p> <p>I've described the three I usually end up using as well as adding some links at the bottom of the answer.</p> <p>How to define which is the best method really depends - the XMLDocument method is in some regards the tidiest except that if your schema changes this can break without you knowing it. <a href="http://www.traceofthought.net/CommentView.aspx?guid=c1164c59-72e2-49e2-be7a-47e4e8dc46d4" rel="nofollow noreferrer">Scott Colestock</a> describes some methods of mitigating that risk.</p> <p>The BizTalk Mapping method is probably the simplest to understand and won't break when the schema changes. For small schemas this can be a good choice.</p> <p>For all of these methods an important thing to remember is that if you want to use distinguished fields or promoted properties you will want to create empty elements to populate. You will hit runtime <code>XLANG</code> errors if you try to assign values to elements that are missing (even though those elements may be optional)</p> <h2>BizTalk Map</h2> <p>The simplest option is to just use a BizTalk map - you don't even necessarily need to map anything into the created instance.</p> <p>To create empty elements you can just map in a string concatenation functoid with an empty string parameter.</p> <h2>Assign one message to another</h2> <p>If you want to create a new instance of a message you can simply copy one mesage to another message of the same schema, in a message assignment shape. </p> <h2>Use an XMLDocument variable</h2> <p>For this you create an orchestration variable of type <code>XMLDocument</code> and then in a <code>message assignment</code> use the <code>LoadXML</code> method to load an XML snippet that matches your schema. You then assign the <code>XMLDocument</code> to the desired BizTalk message.</p> <pre><code>varXMLDoc.LoadXml(@"&lt;ns0:SomeXML&gt;&lt;AnElementToPopulate&gt;&lt;/AnElementToPopulate&gt;&lt;/SomeXML&gt;"); msgYourMessage = varXMLDom; </code></pre> <p>The inclusion of <code>AnElementToPopulate</code> allows you to using property promotion to assign to it.</p> <p>I seldom remember the syntax to do this off the top of my head, <a href="http://blogs.objectsharp.com/post/2004/11/09/Constructing-BizTalk-2004-XML-Messages-(In-an-Orchestration)-Choices.aspx" rel="nofollow noreferrer">this</a> is my go to blog entry for reminding myself of the syntax.</p> <p>Another link <a href="http://www.sabratech.co.uk/blogs/yossidahan/2008/03/creating-message-from-scratch.html" rel="nofollow noreferrer">here</a> details some methods.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload