At the base is the simple question of where does one start? Well, that's simple enough, just go to your map in Visual Studio, and right-click to perform a "Test map" operation. If you don't have a map, create a temporary map and make sure you apply the "Generate Instance" setting in the TestMap Input field. In the Output window, you'll find a link to the sample input file leveraged to generate the test. Open this sample and voila! You have the xml needed to help generate your request message.
With the sample xml available, you can then create a class that performs the generate request message code. Modify the xml values such that you can modify them from outside of BizTalk (perhaps in a config file). Below follows sample code outlining message creation process.
public static XmlDocument CreateMsg(string msgType)
{
     XmlDocument xmlDoc = new XmlDocument();
       StringBuilder strBuilder = new StringBuilder();
            string columnString = string.Empty; \\ ex "column1 as [Sales], column2 as [Pct]
            string filterString = string.Empty; \\ ex "WHERE DATEDIFF(Day, LAST_DATE_WORKED, getdate()) < 8"
            strBuilder.Append("");
            switch (msgType.ToUpper().Trim())
            {
                case "A Specific Message":
                    columnString = ConfigurationManager.AppSettings["myRunTimeColumns"];
                    filterString = ConfigurationManager.AppSettings["myRunTimeWhereClause"];
                    strBuilder.Append(string.Format("{0} ",
    columnString));
                    strBuilder.Append(string.Format("{0} ",
    filterString));
                    strBuilder.Append(" ");
                    break;
                default:
                    strBuilder.Append("FirstName, LastName, OfficeNumber, case Code when '850' then Dept else Region end as LocationCode, Email ");
                    strBuilder.Append("And of course, you would have to declare a message object in your orchestration and initialize it from within the orchestration as such:
MyRequestMsg = HelperNameSpace.MessageConstructorClass.CreateMsg("A Specific Message");
For this example, I populated the BizTalk service config file with new keys under the appSettings node (myRunTimeColumns and myRunTimeWhereClause) to hold the column and where clause values respectively.
 
 
