<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.objectsharp.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Matt Meleski's .Net Blog - The ABC's of .NET</title><subtitle type="html">ASP.NET/ADO.NET/Biztalk 2004/C#</subtitle><id>http://blogs.objectsharp.com/blogs/matt/atom.aspx</id><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/default.aspx" /><link rel="self" type="application/atom+xml" href="http://blogs.objectsharp.com/blogs/matt/atom.aspx" /><generator uri="http://communityserver.org" version="2.1.61129.2">Community Server</generator><updated>2004-05-02T14:07:00Z</updated><entry><title>Robust Error Handling for BizTalk Solutions Presentation</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2007/11/07/robust-error-handling-for-biztalk-solutions-presentation.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2007/11/07/robust-error-handling-for-biztalk-solutions-presentation.aspx</id><published>2007-11-07T01:01:00Z</published><updated>2007-11-07T01:01:00Z</updated><content type="html">&lt;P&gt;I presented at the Microsoft SOA and Business Process Conference last week in Redmond. The title of the presentation was:&lt;/P&gt;
&lt;P&gt;Robust Error Handling for BizTalk Solutions.&lt;/P&gt;
&lt;P&gt;I did the presentation once on Thurs Nov 1 and again on Friday Nov 2. A number of people who attended the &lt;BR&gt;presentation were asking for the demo code and powerpoint. The zipped code is &lt;A class="" href="http://objectsharp.com/cs/files/folders/95980/download.aspx"&gt;&lt;STRONG&gt;here&lt;/STRONG&gt;&lt;/A&gt; and the powerpoint from the presentation is &lt;A class="" href="http://objectsharp.com/cs/files/folders/95981/download.aspx"&gt;&lt;STRONG&gt;here&lt;/STRONG&gt;&lt;/A&gt;. Hopefully when I have more time, I will try to write a more formal blog entry describing some of the techniques for error handling in BizTalk. Also for anybody who attended the conference and missed my presentation, you can catch the recorded presentation on a post conference DVD, that should be mailed out to all attendees in the next month or so.&lt;BR&gt;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=95982" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>BizTalk -&gt; Custom Pipeline Component for Processing DBF, Excel and other ODBC types</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2007/06/15/test.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2007/06/15/test.aspx</id><published>2007-06-15T12:27:00Z</published><updated>2007-06-15T12:27:00Z</updated><content type="html">&lt;P&gt;I deleted the original post by mistake (woops!), so below is to replace the deleted one.&lt;BR&gt;&lt;BR&gt;Last year a customer had a requirement to process DBF files in BizTalk. I created a custom pipeline component that saved the incoming binary stream to a physical file on the BizTalk machine and then used basic ADO.NET to&amp;nbsp;parse the DBF File into an XML document. I then modified/extended this pipeline component to accept and parse other ODBC files to XML, such as:&lt;/P&gt;
&lt;P&gt;DBF&lt;BR&gt;Excel&lt;BR&gt;FoxPro&lt;BR&gt;Possibly others such as Access Files.&lt;/P&gt;
&lt;P&gt;At this point in time, this custom pipeline component will only parse Excel and DBF files, but it is possible to modify the component to process other ODBC types.&lt;/P&gt;
&lt;P&gt;By using this custom pipeline component in a BizTalk Receive Pipeline it will do the following:&lt;/P&gt;
&lt;P&gt;Raw DBF, Excel messages are delivered to BizTalk by any transport such as:&lt;BR&gt;File&lt;BR&gt;FTP&lt;BR&gt;MSMQ&lt;BR&gt;etc. etc.&lt;/P&gt;
&lt;P&gt;The raw message will be parsed to XML in a BizTalk Receive Pipeline with the parsed XML message published into the MsgBox.&lt;/P&gt;
&lt;P&gt;This component requires no special APIs and uses basic ADO.NET code to parse the ODBC type files into XML.&lt;/P&gt;
&lt;P&gt;You can download the full source code for the Custom Pipeline component at the end of this entry.&lt;/P&gt;
&lt;P&gt;The component works as below:&lt;/P&gt;
&lt;P&gt;1) The incoming file is saved to a temporary file on the BizTalk machine.&lt;BR&gt;2) An OLEDB connection will be used to connect to the file from 1).&lt;BR&gt;3) A Sql query is performed against the OLEDB datasource.&lt;BR&gt;4) The results from the query are stored to an ADO.NET dataset/datatable.&lt;BR&gt;5) The XML is extracted from the datatable and modified for a root node name and target namespace.&lt;BR&gt;6) The temporary file from 1) is deleted&lt;BR&gt;7) The XML from 5) is added back to the pipeline message stream.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;The custom pipeline component was coded as a Decoder pipeline component, but it could be modified to implement a Disassembler pipeline component.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/ODBCPipelineComponentInPipeline.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The Custom Pipeline Component exposes a number of properties for dynamic configuration.&lt;/P&gt;
&lt;P&gt;The connection string and query differs slightly for an Excel and DBF file. Therefore the configuration for an Excel file and DBF file are discussed separately:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Excel&lt;BR&gt;&lt;/U&gt;&lt;BR&gt;&lt;/STRONG&gt;The incoming Excel file to be parsed looks as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/ODBCPipelineComponentExcel.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The resultant parsed XML file will look as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/ODBCPipelineComponentExcelXML.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Note: Only two Employee nodes are present in the XML file due to a filter condition in the configuration (see below).&lt;/P&gt;
&lt;P&gt;The Configuration for this Pipeline is as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/ODBCPipelineComponentExcelProperties.jpg"&gt;&lt;/P&gt;
&lt;P&gt;1) ConnectionString -&amp;gt; The OLEDB Connection string for the Excel file.&lt;BR&gt;The following is set for the ConnectionString property:&lt;BR&gt;&lt;EM&gt;Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Excel 8.0;&lt;BR&gt;&lt;/EM&gt;But, the final Connection String that is produced by the code looks like below: &lt;BR&gt;&lt;EM&gt;Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Excel 8.0;Data Source=C:\Temp\afgd1234.xls&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;This is because the code, dumps the Excel File to the TempDropFolderLocation and must dynamically add the Data Source section to the connection string.&lt;/P&gt;
&lt;P&gt;Note : Other Connection Properties for an Excel File:&lt;/P&gt;
&lt;P&gt;"HDR=Yes;" indicates that the first row contains columnnames, not data&lt;BR&gt;"IMEX=1;" tells the driver to always read "intermixed" data columns as text&lt;BR&gt;(Above From: &lt;A href="http://www.connectionstrings.com/"&gt;http://www.connectionstrings.com/&lt;/A&gt; )&lt;/P&gt;
&lt;P&gt;2) DataNodeName -&amp;gt; The XML Node name for the Data. In this case Employee &lt;/P&gt;
&lt;P&gt;3) DeleteTempMessages -&amp;gt; If set to True, will delete the Excel file that is dropped to the TempDropFolderLocation after processing.&lt;/P&gt;
&lt;P&gt;4) Filter -&amp;gt; Filter for the SqlStatement. In this case, will only Select LastNames Like %B% &lt;BR&gt;Note: This is optional. If all data is to be returned, leave blank.&lt;/P&gt;
&lt;P&gt;5) Namespace -&amp;gt; NameSpace for the resultant XML message. &lt;/P&gt;
&lt;P&gt;6) RootNodeName -&amp;gt; Root Node Name for the resultant XML Message.&lt;/P&gt;
&lt;P&gt;7) SqlStatement -&amp;gt; OLEDB Select Statement.&lt;BR&gt;SQL syntax: SELECT * FROM [sheet1$] - i.e. worksheet name followed by a "$" and wrapped in "[" "]" brackets.&lt;BR&gt;(Above From: &lt;A href="http://www.connectionstrings.com/"&gt;http://www.connectionstrings.com/&lt;/A&gt; )&lt;/P&gt;
&lt;P&gt;Note: The SqlStatement could also look as below:&lt;BR&gt;Select FirstName,LastName FROM [sheet1$]&amp;nbsp; (only bring back selected columns)&lt;BR&gt;Select FirstName as FName, LastName as LName FROM [sheet1$] (rename the column Names in the resultant XML)&lt;/P&gt;
&lt;P&gt;8) TypeToProcess -&amp;gt; In this case Excel File.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;DBF&lt;/U&gt;&lt;BR&gt;&lt;/STRONG&gt;&lt;BR&gt;The incoming DBF file to be parsed looks as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/ODBCPipelineComponentDBF.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The resultant parsed XML file will look as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/ODBCPipelineComponentDBFXML.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Note: Only two Items nodes are present in the XML file due to a filter condition in the configuration (see below).&lt;/P&gt;
&lt;P&gt;The Configuration for this Pipeline is as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/ODBCPipelineComponentDBFProperties.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Note: The above is an example of Per Instance Pipeline Configuration for BizTalk 2006.&lt;BR&gt;&lt;BR&gt;1) ConnectionString -&amp;gt; The OLEDB Connection string for the DBF file.&lt;BR&gt;The following is set for the ConnectionString property:&lt;BR&gt;&lt;EM&gt;Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=dBASE IV;&lt;BR&gt;&lt;/EM&gt;But, the final Connection String that is produced by the code looks like below: &lt;BR&gt;&lt;EM&gt;Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=dBASE IV;Data Source=C:\Temp\&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;This is because the code, dumps the DBF File to the TempDropFolderLocation and must dynamically add the Data Source section to the connection string.&lt;/P&gt;
&lt;P&gt;2) DataNodeName -&amp;gt; The XML Node name for the Data. In this case Items&lt;/P&gt;
&lt;P&gt;3) DeleteTempMessages -&amp;gt; If set to True, will delete the DBF file that is dropped to the TempDropFolderLocation after processing.&lt;/P&gt;
&lt;P&gt;4) Filter -&amp;gt; Filter for the SqlStatement. In this case, will only Select PRICE &amp;gt;= 200 and PRICE &amp;lt;=500 &lt;BR&gt;Note: This is optional. If all data is to be returned, leave blank.&lt;/P&gt;
&lt;P&gt;5) Namespace -&amp;gt; NameSpace for the resultant XML message. &lt;/P&gt;
&lt;P&gt;6) RootNodeName -&amp;gt; Root Node Name for the resultant XML Message.&lt;/P&gt;
&lt;P&gt;7) SqlStatement -&amp;gt; OLEDB Select Statement.&lt;/P&gt;
&lt;P&gt;In this case only have the columns part of the Select Statement as below:&lt;BR&gt;Select *&amp;nbsp; &lt;/P&gt;
&lt;P&gt;This is because the code dumps the DBF File to the TempDropFolderLocation and must dynamically add the FROM statement as below:&lt;BR&gt;SELECT * FROM i0lb1gcr.dbf&lt;BR&gt;&amp;nbsp;&lt;BR&gt;Note: The SqlStatement could also look as below:&lt;BR&gt;Select COD, PRICE (only bring back selected columns)&lt;BR&gt;Select COD as Id, Price as Amount (rename the Node Names in the resultant XML)&lt;/P&gt;
&lt;P&gt;8) TypeToProcess -&amp;gt; In this case DBF File.&lt;BR&gt;Note: When configuring a Pipeline Component in the BizTalk Server 2006 Administration console, &lt;BR&gt;for TypeToProcess :&lt;BR&gt;0 -&amp;gt; Excel&lt;BR&gt;1 -&amp;gt; DBF&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;You can download the code &lt;A href="http://www.objectsharp.com/blogs/matt/images/ODBCCustomPipe.zip"&gt;&lt;STRONG&gt;Here&lt;/STRONG&gt;&lt;/A&gt;. Before installing, look at the &lt;A href="http://www.objectsharp.com/blogs/matt/images/ODBCCustomReadMe.txt"&gt;&lt;STRONG&gt;Readme&lt;BR&gt;&lt;/STRONG&gt;&lt;/A&gt;Note: This code was written in VS2005. If you want to use it in VS2003, create a new Pipeline type of project in VS2003 and then just copy the code from the DecodeODBC.cs to the VS2003 class. Also thoroughly test the code before using.&lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;Finally:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;The not so good things about this Component are:&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;1) It has to write the ODBC file locally to disk before parsing. This will create &lt;BR&gt;extra disk I/O. I did test it with multiple submissions of 1 MB DBF files. The performance still seemed &lt;BR&gt;pretty good.&lt;/P&gt;
&lt;P&gt;2) The types of Excel files it can process are flat. If you're Excel files to process are &lt;BR&gt;complex, not sure how well this Component will parse to XML. &lt;/P&gt;
&lt;P&gt;&lt;U&gt;The good things about this component are:&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;1) The code to parse the ODBC files is dead simple, looks something like the below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;OleDbDataAdapter oCmd;&lt;BR&gt;&amp;nbsp;// Get the filter if there is one&lt;BR&gt;&amp;nbsp;string whereClause = " ";&lt;BR&gt;&amp;nbsp;if (Filter.Trim() != " ")&lt;BR&gt;&amp;nbsp;&amp;nbsp; whereClause = " Where " + Filter.Trim();&lt;BR&gt;&amp;nbsp;if (this.TypeToProcess == odbcType.Excel)&lt;BR&gt;&amp;nbsp;&amp;nbsp; oCmd = new OleDbDataAdapter(this.SqlStatement.Trim() + whereClause, oConn);&lt;BR&gt;&amp;nbsp;else // dbf&lt;BR&gt;&amp;nbsp;&amp;nbsp; oCmd = new OleDbDataAdapter(this.SqlStatement.Trim() + " From " + filename + whereClause, oConn);&lt;BR&gt;&amp;nbsp;oConn.Open();&lt;BR&gt;&amp;nbsp;// Perform the Select statement from above into a dataset, into a DataSet. &lt;BR&gt;&amp;nbsp;DataSet odbcDataSet = new DataSet();&lt;BR&gt;&amp;nbsp;oCmd.Fill(odbcDataSet, this.DataNodeName);&lt;BR&gt;&amp;nbsp;oConn.Close();&lt;BR&gt;&amp;nbsp;// Write the XML From this DataSet into a String Builder&lt;BR&gt;&amp;nbsp;System.Text.StringBuilder stringBuilder = new StringBuilder();&lt;BR&gt;&amp;nbsp;System.IO.StringWriter stringWriter = new System.IO.StringWriter(stringBuilder);&lt;BR&gt;&amp;nbsp;odbcDataSet.Tables[0].WriteXml(stringWriter);&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;2) This code can be modified to process other types of ODBC files. The modifications &lt;BR&gt;may be minor.&lt;/P&gt;
&lt;P&gt;3) You can filter the data in an incoming Excel or DBF file.&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=59889" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>BizTalk R2 RFID and working with a real Reader Device (Phidget)</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2007/06/09/biztalk-r2-rfid-and-working-with-a-real-reader-device-phidget.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2007/06/09/biztalk-r2-rfid-and-working-with-a-real-reader-device-phidget.aspx</id><published>2007-06-09T18:07:00Z</published><updated>2007-06-09T18:07:00Z</updated><content type="html">&lt;P&gt;This entry discusses using a real RFID reader (Phidget) with BizTalk 2006 R2 RFID Beta 2. There are a couple of RFID samples provided with the RFID install, but they involve simulators for RFID devices. If you want to try a real RFID reader sample with BizTalk 2006 R2 RFID, read below.&lt;BR&gt;&lt;BR&gt;Jim Bowyer, a Senior Technical Specialist for Microsoft based in Calgary, sent out a short note about an inexpensive&amp;nbsp;RFID reader that has a community DSPI (Device Service Provider Interface)&amp;nbsp; for BizTalk R2 RFID. &lt;BR&gt;&lt;BR&gt;So I ordered the RFID reader, downloaded the DSPI and then tried against my BizTalk 2006 R2 RFID Beta 2 installation.&lt;/P&gt;
&lt;P&gt;If you want to try yourself, perform the following steps:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1) If not already done so, register for public&lt;/STRONG&gt; &lt;A class="" href="http://support.microsoft.com/?kbid=936046"&gt;&lt;STRONG&gt;BizTalk 2006 R2 Beta&lt;/STRONG&gt;&lt;/A&gt;&amp;nbsp;2, &lt;STRONG&gt;then download.&lt;/STRONG&gt;&lt;BR&gt;Follow the instructions to install BizTalk RFID.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2) Order the&lt;/STRONG&gt; &lt;A class="" href="http://www.trossenrobotics.com/store/p/3606-PhidgetsRFID-Reader-Only-USB-.aspx"&gt;&lt;STRONG&gt;PhidgetsRFID Reader (USB)&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I opted to order the &lt;A class="" href="http://www.trossenrobotics.com/store/p/3604-RFID-Kit.aspx"&gt;&lt;STRONG&gt;Phidget RFID Kit&lt;/STRONG&gt;&lt;/A&gt;, that includes a set of read only tags. &lt;/P&gt;
&lt;P&gt;I live in Toronto, Canada, so the total cost for the RFID kit was:&lt;/P&gt;
&lt;P&gt;$79.99 (US)&amp;nbsp; Kit&lt;BR&gt;$49.74 (US)&amp;nbsp; Shipping&lt;BR&gt;$11.98 (CAN) Customs Fees&lt;BR&gt;-------------------&lt;BR&gt;$141.71&lt;/P&gt;
&lt;P&gt;If you live in the States, you will probably get a cheaper total cost, for reduced shipping fees and no customs charges. I ordered the kit online on Friday, and received it the next Tuesday. So approximately 2 Business days for delivery. &lt;BR&gt;&amp;nbsp;&lt;BR&gt;Below is the image of what you get in the kit:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://objectsharp.com/cs/files/folders/56808/download.aspx"&gt;&lt;/P&gt;
&lt;P&gt;The left hand side of the picture contains the various RFID tags, and the right side is the actual RFID reader. A USB cable is also included, so you can connect the RFID reader to a free USB port on your computer.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;3) Connect the Phidget RFID reader to your computer via the USB cable.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;My host machine is Windows XP. The Phidget device was picked up immediately. No extra drivers etc. were needed.&lt;/P&gt;
&lt;P&gt;As below, I have BizTalk 2006 R2 Beta 2 and BizTalk RFID installed on a Windows 2003 VMWare image.&lt;BR&gt;So as below, the extra step in this case was to configure the VMWare image to pick up the Phidgets USB device.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://objectsharp.com/cs/files/folders/56807/download.aspx"&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;4) Download and install the Phidget DSPI from Irving De la Cruz's Blog&lt;/STRONG&gt;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/irvingd/pages/biztalk-rfid-device-provider-dspi-for-phidget-devices.aspx"&gt;http://blogs.msdn.com/irvingd/pages/biztalk-rfid-device-provider-dspi-for-phidget-devices.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The instructions provided with the download are top notch and I had it up and running within a few minutes. To install the DSPI, Irving provides a script file &lt;BR&gt;or a well documented manual process using the RFID Manager console. I used the manual process to install and had only a couple of minor problems as described below: &lt;/P&gt;
&lt;P&gt;After installing the Phidget Device provider, it would not start (received RFID Manager Error). See below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://objectsharp.com/cs/files/folders/56805/download.aspx"&gt;&lt;/P&gt;
&lt;P&gt;During the configuration of Phidget Device provider, an IIS virtual directory hosting a number of&amp;nbsp; WCF services is created as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://objectsharp.com/cs/files/folders/56804/download.aspx"&gt;&lt;/P&gt;
&lt;P&gt;As below, when trying to browse to one of the services &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://objectsharp.com/cs/files/folders/56803/download.aspx"&gt;&lt;/P&gt;
&lt;P&gt;A&amp;nbsp;Service Unavailable error was reported (see below)&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://objectsharp.com/cs/files/folders/56802/download.aspx"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;To fix:&lt;/P&gt;
&lt;P&gt;On my Windows 2003 Server, WSS (Sharepoint) Services 2.0 was also&amp;nbsp;present (from a previous install) along with RFID.&lt;BR&gt;Therefore as below, I excluded the PhidgetProvider&amp;nbsp;URL from the WSS managed paths.&lt;BR&gt;Also for the PhidgetProvider Virtual Directory, I changed the Application Pool to one that runs under an Administrator account (just to get it to work). Once this was done, the PhidgetProvider would start in the RFID Manager.&lt;BR&gt;To recap, if you are having problems starting the Phidget Provider, ensure that you can successfully browse without error to one of the &lt;BR&gt;.svc services, before trying to start the Phidget Provider.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://objectsharp.com/cs/files/folders/56801/download.aspx"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Another problem I had similar to the one above:&lt;BR&gt;After configuring the Sql Sink Process to capture the RFID reads (using the BizTalk RFID Manager), the process would not start.&lt;BR&gt;As below, another IIS virtual directory is created hosting a number of&amp;nbsp;WCF services. As explained above with the PhidgetProvider service, errors were reported when trying to &lt;BR&gt;browse to one of the TestProcess .svc services. Therefore as above with the PhidgetProvider URL, I excluded the TestProcess&amp;nbsp;URL from the WSS managed paths&lt;BR&gt;and fiddled with the permissions of the App Pool that the service was running under. When I could successfully browse to one of the .svc TestProcess &lt;BR&gt;services, the TestProcess successfully started in RFID manager.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://objectsharp.com/cs/files/folders/56800/download.aspx"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;5) Test&lt;BR&gt;&lt;BR&gt;&lt;/STRONG&gt;After following the instructions in Irving's documentation, and the Phidget Device Provider, Phidget Device and Process to capture the reads are all enabled and have started successfully without errors (use the BizTalk RFID manager to check):&lt;BR&gt;As below to test, place one of the tags within a few inches of the reader.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://objectsharp.com/cs/files/folders/56806/download.aspx"&gt;&lt;/P&gt;
&lt;P&gt;Then as below to see if it worked, using the RFID manager you can view the read tags with the View Tags dialog.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://objectsharp.com/cs/files/folders/56799/download.aspx"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;As above in the dialog, each tag has a unique Tag Id associated.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Final thoughts:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;- Easy to set up. &lt;BR&gt;- The RFID reader is inexpensive, shipping costs may be expensive though, depending on where you live.&lt;BR&gt;- So far has been stable.&lt;BR&gt;- A great way to prototype/experiment with BizTalk RFID and a real RFID device.&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=56809" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>SqlBulkInsert Adapter for VS2003 and BizTalk 2004</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2007/04/19/sqlbulkinsert-adapter-for-vs2003-and-biztalk-2004.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2007/04/19/sqlbulkinsert-adapter-for-vs2003-and-biztalk-2004.aspx</id><published>2007-04-19T00:13:00Z</published><updated>2007-04-19T00:13:00Z</updated><content type="html">&lt;P&gt;A few people have asked for the BizTalk 2004 version of this &lt;A class="" href="http://objectsharp.com/cs/blogs/matt/archive/2005/10/23/3525.aspx"&gt;&lt;STRONG&gt;BizTalk SqlBulkInsert 2006 Adapter&lt;/STRONG&gt;&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;Follow the&amp;nbsp;below instructions to install on BizTalk 2004:&lt;/P&gt;
&lt;P&gt;1) Download the zip file at the end of this blog entry.&lt;BR&gt;2) When unzipping, unzip it a different folder such as: C:\temp&amp;nbsp; &lt;BR&gt;3) Copy the unzipped contents -&amp;gt; C:\Temp\BTSBulkLoad\SqlBulkInsertAdapter directory&lt;BR&gt;to the C:\BTSBulkLoad\ directory that was created by the BizTalk 2006 zip file that you can find &lt;A class="" href="http://objectsharp.com/cs/blogs/matt/archive/2005/10/23/3525.aspx"&gt;&lt;STRONG&gt;here&lt;/STRONG&gt;&lt;/A&gt;:&lt;BR&gt;(Look at the bottom of the above referenced blog entry for the download and Readme instructions).&lt;BR&gt;Just replace the&amp;nbsp; VS2005 C:\BTSBulkLoad\SqlBulkInsertAdapter folder contents with the VS2003 SqlBulkInsertAdapter directory contents.&lt;BR&gt;4) Follow the below installation &lt;A class="" href="http://objectsharp.com/cs/blogs/matt/images/BTSBulkLoadReadme.txt"&gt;&lt;STRONG&gt;instructions&lt;/STRONG&gt;&lt;/A&gt; for the BizTalk 2006 adapter to install the BTS 2004 adapter&lt;BR&gt;&amp;nbsp;&lt;BR&gt;Remember that this is just a prototype, so you will have to fix the code to get it to work properly. Peter (see comments from this blog &lt;A class="" href="http://objectsharp.com/cs/blogs/matt/archive/2005/10/23/3525.aspx"&gt;&lt;STRONG&gt;entry&lt;/STRONG&gt;&lt;/A&gt;) has stated that he has a BizTalk 2004 version of the adapter working.&lt;BR&gt;Download the BizTalk 2004 adapter (Zip file) &lt;A class="" href="http://objectsharp.com/cs/files/folders/40683/download.aspx"&gt;&lt;STRONG&gt;here&lt;BR&gt;&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=40689" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>BizTalk Message Helper Methods</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2007/04/17/biztalk-message-helper-methods.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2007/04/17/biztalk-message-helper-methods.aspx</id><published>2007-04-16T23:21:00Z</published><updated>2007-04-16T23:21:00Z</updated><content type="html">This entry describes two helper methods to interact with messages in a BizTalk orchestration. The first helper methods will return the string representation of a BizTalk message. The methods are as below: /// &amp;lt;summary&amp;gt; /// Pass in a BizTalk Message will return a string /// &amp;lt;/summary&amp;gt; /// &amp;lt;param name="btsMessage"&amp;gt;The BizTalk message to get the string from&amp;lt;/param&amp;gt; /// &amp;lt;returns&amp;gt;The string from the Body of the BTS Message&amp;lt;/returns&amp;gt; public static string GetStringFromBTSMessageBody(XLANGMessage...(&lt;a href="http://blogs.objectsharp.com/blogs/matt/archive/2007/04/17/biztalk-message-helper-methods.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=40328" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>Turning an Immutable Message in BizTalk into a Mutable message</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2007/04/09/turning-an-immutable-message-in-biztalk-into-a-mutable-message.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2007/04/09/turning-an-immutable-message-in-biztalk-into-a-mutable-message.aspx</id><published>2007-04-09T22:19:00Z</published><updated>2007-04-09T22:19:00Z</updated><content type="html">&lt;P&gt;One thing that you learn pretty fast in BizTalk is that messages in an orchestration are immutable/read only.&lt;/P&gt;
&lt;P&gt;If you need to modify a message in a BizTalk orchestration, you are pretty well restricted to using a Construct shape with encapsulated Transform and/or Message Assignment shapes to create a modified version or a copy of the original message. Distinguished fields,xpath statements, BizTalk maps, custom .Net components, etc. can be used to modify the message.&lt;/P&gt;
&lt;P&gt;Below is one simple technique that can be used to modify a message anywhere in an orchestration.&lt;BR&gt;Helper&amp;nbsp;class(s) are required, but in certain situations (explained below) this technique can be used to easily modify a message anywhere in an orchestration.&lt;/P&gt;
&lt;P&gt;Below is an orchestration where this technique is used:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://objectsharp.com/cs/files/folders/37818/download.aspx"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Very simply this orchestration subscribes to a PO xml message and then produces a &lt;BR&gt;final Invoice XML message that is send out from the orchestration.&lt;/P&gt;
&lt;P&gt;Below are the artifacts used in the solution:&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG style="WIDTH:246px;HEIGHT:262px;" height=262 src="http://objectsharp.com/cs/files/folders/38898/download.aspx" width=246&gt;&lt;/P&gt;
&lt;P&gt;The artifacts for the BizTalk project, BTS_Immutable_To_Mutable include:&lt;BR&gt;&lt;BR&gt;1) ClassOrchestration.odx (Orchestration as above)&lt;BR&gt;2) Invoice.xsd (schema for outgoing Invoice XML message)&lt;BR&gt;3) PO.xsd (schema for incoming PO XML message).&lt;BR&gt;4) InvoiceClassGen.bat and POClassGen.bat&lt;/P&gt;
&lt;P&gt;Below is the InvoiceClassGen.bat file:&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://objectsharp.com/cs/files/folders/37819/download.aspx"&gt;&lt;/P&gt;
&lt;P&gt;The above uses the .Net xsd.exe utility to generate an Invoice.cs class from the Invoice.xsd schema.&lt;BR&gt;This Invoice.cs class is used in the Class_Immutable_To_Mutable project as below.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;The artifacts for the Class Library project, Class_Immutable_To_Mutable include:&lt;/P&gt;
&lt;P&gt;1) Helper.cs (Helper Class to populate the some of the fields of the Invoice)&lt;BR&gt;2) Invoice.cs (Invoice class for variable in the orchestration)&lt;BR&gt;3) PO.cs (PO class for variable in the orchestration)&lt;/P&gt;
&lt;P&gt;This orchestration will:&lt;/P&gt;
&lt;P&gt;1) Accept a PO xml message&lt;/P&gt;
&lt;P&gt;2) As below, in an expression shape, assign the BTS PO message to a BTS variable message of type PO.cs&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;// Set the BTS Variable PO to the incoming BTS Message PO&lt;/STRONG&gt;&lt;BR&gt;&lt;STRONG&gt;varPO = msgPO;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;3) As below, in an expression shape, populate some of the Invoice fields from the PO fields:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;// Populate some of the fields in the BTS Invoice Variable,&lt;BR&gt;// from the BTS PO variable fields. &lt;BR&gt;varInvoice.TotalAmt = varPO.Amt;&lt;BR&gt;varInvoice.TotalCount = varPO.Qty;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;4) As below, in an expression shape, call a helper class to populate and return the Invoice Items class:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;varInvoice.Items = Class_Immutable_To_Mutable.Helper.mapPOItemsToInvoiceItems(varPO);&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;5) As below, in an expression shape, call a helper class to return and assign the description for the invoice Description field.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;// Set the BTS Variable Description field&lt;BR&gt;varInvoice.Description = Class_Immutable_To_Mutable.Helper.GetInvoiceDesc(varInvoice);&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;6) As below, in an expression shape, call a helper class to return and assign the version for the invoice Version field:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;// Set the BTS Message Invoice Version field&lt;BR&gt;varInvoice.Version = Class_Immutable_To_Mutable.Helper.GetInvoiceVersion();&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;7) Finally at the end, in a Construct/Message Assignment shape, construct the the outgoing BTS Invoice message:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;// Create the BTS Invoice message from the Variable Invoice message&lt;BR&gt;msgInvoice = varInvoice;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;8) Send out the Final Invoice XML message&lt;BR&gt;&amp;nbsp;&lt;BR&gt;So after all of this, could a BizTalk map been used to create the Invoice message from the PO message. The answer is yes or no depending on the mapping logic that is needed.&lt;/P&gt;
&lt;P&gt;This leads to when use this method:&lt;BR&gt;Creation of a message requires multiple calls to Helper components/Business Rules to create the message. &lt;/P&gt;
&lt;P&gt;Some of the upsides to using this approach are:&lt;BR&gt;1) Using the above technique takes away the restriction of the immutable message and working with a mutable variable in the orchestration.&lt;BR&gt;2) Intellisense is available on the variables inside of the orchestration.&lt;BR&gt;3) The variable can be modified directly in an expression shape inside of the orchestration, without the use of distinguished fields or xpath statements.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some of the downsides to using this approach are:&lt;BR&gt;1) The overhead of deserialization and serialization from Message to Variable and visa versa.&lt;BR&gt;2) Creating and maintaining the Helper classes (in this case PO.cs and Invoice.cs)&lt;BR&gt;&lt;BR&gt;You can download&amp;nbsp;the above example &lt;A class="" href="http://objectsharp.com/cs/files/folders/38910/download.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt; (Zip File).&lt;BR&gt;Read the &lt;A class="" href="http://objectsharp.com/cs/files/folders/38911/download.aspx"&gt;&lt;STRONG&gt;Readme&lt;/STRONG&gt;&lt;/A&gt; before installing and running the example.&lt;/P&gt;
&lt;P&gt;For a similar example, goto&amp;nbsp;&lt;STRONG&gt;&lt;A class="" href="http://msdn2.microsoft.com/en-us/biztalk/aa937647.aspx"&gt;Here&lt;/A&gt;&lt;/STRONG&gt;&lt;BR&gt;and download the &lt;A href="http://download.microsoft.com/download/b/1/d/b1d9ddf9-88c6-4d4e-abea-4787fdc85bec/customnettypeinorchestration.exe"&gt;&lt;STRONG&gt;Using a Custom .NET Type for a Message in Orchestrations&lt;/STRONG&gt;&lt;/A&gt;&amp;nbsp;example.&lt;BR&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=36879" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>Follow up to Fundamentals of WF Presentation and Developer Resources for WF</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2007/03/24/follow-up-to-fundamentals-of-wf-presentation-and-developer-resources-for-wf.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2007/03/24/follow-up-to-fundamentals-of-wf-presentation-and-developer-resources-for-wf.aspx</id><published>2007-03-24T18:59:00Z</published><updated>2007-03-24T18:59:00Z</updated><content type="html">&lt;P&gt;A few people asked for the demos from this &lt;A class="" href="http://objectsharp.com/cs/blogs/matt/archive/2007/03/19/fundamentals-of-wf.aspx" target=_blank&gt;&lt;STRONG&gt;presentation&lt;/STRONG&gt;&lt;/A&gt;.&lt;BR&gt;&lt;BR&gt;Links for the presentation are at the bottom of the post&lt;/P&gt;
&lt;P&gt;If you have not already set up your development environment for Windows Workflow Foundation (WF) Development, follow the below steps:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Prerequisites:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;a) Windows XP, Windows 2003, Windows Vista&lt;BR&gt;b) Visual Studio 2005&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Install the following:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;1) &lt;A class="" href="http://www.microsoft.com/downloads/details.aspx?familyid=10CC340B-F857-4A14-83F5-25634C3BF043&amp;amp;displaylang=en"&gt;&lt;STRONG&gt;.Net Framework 3.0 Redistributable&lt;/STRONG&gt;&lt;/A&gt;&lt;BR&gt;2) &lt;A class="" href="http://www.microsoft.com/downloads/details.aspx?familyid=5D61409E-1FA3-48CF-8023-E8F38E709BA6&amp;amp;displaylang=en"&gt;&lt;STRONG&gt;Visual Studio 2005 extensions for .NET Framework 3.0 (Windows Workflow Foundation)&lt;/STRONG&gt;&lt;/A&gt;&lt;BR&gt;3) You can also optionally download and install:&lt;BR&gt;&lt;A class="" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=C2B1E300-F358-4523-B479-F53D234CDCCF&amp;amp;displaylang=en"&gt;&lt;STRONG&gt;Microsoft® Windows® Software Development Kit for Windows Vista™ and .NET Framework 3.0 Runtime&amp;nbsp; Components&lt;/STRONG&gt;&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;Before installing the above read the provided instructions. &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Below are some resources for using/learning/developing with WF:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://msdn2.microsoft.com/en-us/library/ms735967.aspx"&gt;&lt;STRONG&gt;MSDN - Windows Workflow Foundation&lt;/STRONG&gt;&lt;/A&gt; &lt;BR&gt;&lt;A class="" href="http://msdn2.microsoft.com/en-us/library/ms735927.aspx"&gt;&lt;STRONG&gt;MSDN - Windows Workflow Foundation Tutorials&lt;/STRONG&gt;&lt;/A&gt;&lt;BR&gt;&lt;A class="" href="http://msdn2.microsoft.com/en-us/library/ms732093.aspx"&gt;&lt;STRONG&gt;MSDN - Windows Workflow Foundation General Reference&lt;/STRONG&gt;&lt;/A&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;A class="" href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032303235&amp;amp;EventCategory=3&amp;amp;culture=en-US&amp;amp;CountryCode=US"&gt;Getting Started with Windows Workflow Foundation Server Virtual Lab&lt;/A&gt;&lt;/STRONG&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;A class="" href="http://www.microsoft.com/downloads/details.aspx?familyid=2e575633-e357-4ee7-aaff-34138f00e830&amp;amp;displaylang=en"&gt;Hands-on Labs for Windows® Workflow Foundation&lt;/A&gt;&lt;/STRONG&gt;&lt;BR&gt;&lt;A class="" href="https://www.microsoftelearning.com/eLearning/courseDetail.aspx?courseId=67819"&gt;&lt;STRONG&gt;Clinic 5136: Introduction to Developing with Windows® Workflow Foundation and Visual Studio® 2005&lt;/STRONG&gt;&lt;/A&gt;&lt;BR&gt;&lt;A class="" href="http://msdn2.microsoft.com/en-us/netframework/aa663328.aspx"&gt;&lt;STRONG&gt;Windows Workflow Foundation Developer Centre&lt;/P&gt;&lt;/STRONG&gt;&lt;/A&gt;
&lt;P&gt;Also please read &lt;STRONG&gt;&lt;A class="" href="http://blogs.msdn.com/pandrew/"&gt;Paul Andrews&lt;/A&gt;&lt;/STRONG&gt; blog (Windows Workflow Foundation Technical Product Manager at&amp;nbsp;Microsoft) for the latest and greatest on WF.&lt;/P&gt;
&lt;P&gt;Download the &lt;A class="" href="http://objectsharp.com/cs/files/folders/37700/download.aspx"&gt;&lt;STRONG&gt;presentation&lt;/STRONG&gt;&lt;/A&gt; demos here.&lt;BR&gt;Please read &lt;A class="" href="http://objectsharp.com/cs/files/folders/37702/download.aspx"&gt;&lt;STRONG&gt;this&lt;/STRONG&gt;&lt;/A&gt; before trying to run.&lt;BR&gt;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=35842" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="WF" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/WF/default.aspx" /></entry><entry><title>MVP Summit 2007</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2007/03/23/mvp-summit-2007.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2007/03/23/mvp-summit-2007.aspx</id><published>2007-03-24T01:54:00Z</published><updated>2007-03-24T01:54:00Z</updated><content type="html">&lt;p&gt;There was a delay in posting this, but just wanted to write a quick note on the MVP &lt;a href="http://mvp.support.microsoft.com/MVPsummit" class=""&gt;&lt;b&gt;Summit&lt;/b&gt;&lt;/a&gt; that I attended last week (March 12 - March 15)&lt;/p&gt;
&lt;p&gt;Overall this was an awesome event, well organized, great sessions.&lt;/p&gt;
&lt;p&gt;Thanks to &lt;b&gt;Sasha Krsmanovic&lt;/b&gt; (MVP Lead - Canada) who provided all the Canadian MVP's with &lt;a href="http://www.flickr.com/photos/canadian_mvp/" class=""&gt;&lt;b&gt;Red Olympic Hockey Jerseys&lt;/b&gt;&lt;/a&gt;&amp;nbsp;worn on the 2nd day of the summit.&amp;nbsp; This really pumped up the Canadian MVPs at Bill Gate's key note that carried on during the&amp;nbsp; rest of the Summit. I received quite of few comments from other non Canadian MVPs about the&amp;nbsp;jersey even when I wasn't wearing the jersey on day 3 of the summit&lt;br&gt;&lt;br&gt;First couple of days at the summit I was hanging out with fellow MVP &lt;a href="http://www.objectsharp.com/" class=""&gt;&lt;b&gt;Objectsharpees&lt;/b&gt;&lt;/a&gt;&lt;br&gt;(past/present and future?):&lt;br&gt;&lt;a href="http://www.objectsharp.com/cs/blogs/barry/" class=""&gt;&lt;b&gt;Barry Gervin&lt;/b&gt;&lt;/a&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; &lt;br&gt;&lt;/b&gt;&lt;a href="http://www.objectsharp.com/cs/blogs/bruce/" class=""&gt;&lt;b&gt;Bruce Johnson&lt;/b&gt;&lt;/a&gt;&lt;b&gt;&amp;nbsp;&lt;br&gt;&lt;/b&gt;&lt;a href="http://msmvps.com/blogs/windsor/" class=""&gt;&lt;b&gt;Rob Winsdor&lt;/b&gt;&lt;/a&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;&lt;/b&gt;&lt;a href="http://geekswithblogs.net/mcassell" class=""&gt;&lt;b&gt;Matt Cassel&lt;/b&gt;&lt;/a&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;&lt;/b&gt;&lt;b&gt;&lt;a href="http://teamsystemrocks.com/blogs/jldavid/" class=""&gt;Jean-Luc David&lt;/a&gt; &lt;br&gt;&lt;a href="http://triplez.mine.nu/blog/" class=""&gt;Justin Lee&lt;/a&gt;&lt;/b&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;&lt;/b&gt;&lt;br&gt;Next couple of days of the summit, I was at the BizTalk/ &lt;a href="http://www.microsoft-watch.com/content/operating_systems/microsoft_forms_new_connected_systems_division.html" class=""&gt;&lt;b&gt;Connected Systems Division&lt;/b&gt;&lt;/a&gt;&amp;nbsp;specific sessions. &lt;/p&gt;
&lt;p&gt;Below are some of the BizTalk MVPs&amp;nbsp;that attended&amp;nbsp;the summit. Sorry if I did not list everyone.&lt;br&gt;&lt;br&gt;&lt;a href="http://www.winterdom.com/weblog/" class=""&gt;&lt;b&gt;Tomas Restrepo&lt;/b&gt;&lt;/a&gt;&lt;b&gt;&amp;nbsp; &lt;br&gt;&lt;/b&gt;&lt;a class=""&gt;&lt;b&gt;Brian&amp;nbsp; Loesgen&lt;/b&gt;&lt;/a&gt;&lt;b&gt;&amp;nbsp;&lt;br&gt;Scott&amp;nbsp; Cairney&amp;nbsp; &lt;br&gt;Ibrahim&amp;nbsp; Gokalp &lt;br&gt;&lt;/b&gt;&lt;a href="http://blog.paul.somers.com/blog" class=""&gt;&lt;b&gt;&lt;/b&gt;&lt;/a&gt;&lt;a href="http://www.geekswithblogs.net/sthomas/" class=""&gt;&lt;b&gt;Stephen Thomas&lt;/b&gt;&lt;/a&gt;&lt;b&gt; &lt;br&gt;&lt;/b&gt;&lt;a class=""&gt;&lt;b&gt;Alan Smith&lt;/b&gt;&lt;/a&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;Romualdas Stonkus &lt;br&gt;&lt;/b&gt;&lt;a href="http://www.masteringbiztalk.com/blogs/jon/" class=""&gt;&lt;b&gt;Jon&amp;nbsp; Flanders&lt;/b&gt;&lt;/a&gt;&lt;b&gt;&amp;nbsp; &lt;br&gt;&lt;/b&gt;&lt;a href="http://weblogs.asp.net/gsusx/" class=""&gt;&lt;b&gt;Jesus Rodriguez&lt;/b&gt;&lt;/a&gt;&lt;b&gt;&amp;nbsp; &lt;br&gt;&lt;/b&gt;&lt;a href="http://blogs.breezetraining.com.au/mickb/" class=""&gt;&lt;b&gt;Mick&amp;nbsp; Badran&lt;/b&gt;&lt;/a&gt;&lt;b&gt;&amp;nbsp; &lt;br&gt;&lt;/b&gt;&lt;a class=""&gt;&lt;b&gt;Scott Colestock&lt;/b&gt;&lt;/a&gt;&lt;b&gt;&amp;nbsp;&lt;br&gt;&lt;/b&gt;&lt;a href="http://www.jonfancey.com/default.aspx" class=""&gt;&lt;b&gt;Jon Fancey&lt;/b&gt;&lt;/a&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;Jeff Juday&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;&lt;/b&gt;&lt;a class=""&gt;&lt;b&gt;Charles Young&lt;/b&gt;&lt;/a&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;Here are a few posts on the content of the BizTalk/Connected System MVP sessions.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geekswithblogs.net/cyoung/archive/2007/03/15/108881.aspx" class=""&gt;Day3&lt;/a&gt; &lt;br&gt;&lt;a href="http://blogs.breezetraining.com.au/mickb/2007/03/16/MVPSummitWrapUp.aspx" class=""&gt;Day3&lt;/a&gt; &lt;br&gt;&lt;a href="http://geekswithblogs.net/cyoung/archive/2007/03/17/109056.aspx" class=""&gt;Day4&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;br&gt;Finally a big thanks to &lt;b&gt;Marjan Kalantar&lt;/b&gt; (Microsoft's Connected Systems Division Community&amp;nbsp; &lt;br&gt;Lead), who put together and organized an eclectic spread of talks that covered the Connected&amp;nbsp; &lt;br&gt;Systems Division and the informal sessions with the Product groups.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=35751" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>Fundamentals of WF</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2007/03/19/fundamentals-of-wf.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2007/03/19/fundamentals-of-wf.aspx</id><published>2007-03-19T22:59:00Z</published><updated>2007-03-19T22:59:00Z</updated><content type="html">&lt;P&gt;Tomorrow (March 20) I am doing a presentation at the Metro Toronto .Net User Group entitled:&lt;BR&gt;&lt;STRONG&gt;Fundamentals of Windows Workflow Foundation (WF).&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Most of it will be demos introducing WF. Of course, I will also include BizTalk in the presentation, discussing the differences and similarities between WF and BizTalk and when it is appropriate to use either technology. &lt;/P&gt;
&lt;P&gt;The demos will include:&lt;/P&gt;
&lt;P&gt;Creating a Sequential Workflow&lt;BR&gt;Communicating with the Host&lt;BR&gt;Logging Workflows&lt;BR&gt;Persisting Workflows&lt;BR&gt;Creating Custom Activities&lt;BR&gt;Creating a State Machine Workflow&lt;BR&gt;Using WF and BizTalk together&lt;/P&gt;
&lt;P&gt;You can sign up for the presentation here:&lt;BR&gt;&lt;A href="http://www.metrotorontoug.com/User+Group+Events/379.aspx"&gt;http://www.metrotorontoug.com/User+Group+Events/379.aspx&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=34414" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="WF" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/WF/default.aspx" /></entry><entry><title>Failed Message Routing and Failed Orchestration Routing in BizTalk 2006</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2006/11/01/4110.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2006/11/01/4110.aspx</id><published>2006-11-01T20:51:00Z</published><updated>2006-11-01T20:51:00Z</updated><content type="html">&lt;p&gt;This post discusses Failed Message Routing and Failed Orchestration Routing in BizTalk 2006&lt;/p&gt;
&lt;p&gt;&lt;u&gt;Failed Message Routing&lt;br /&gt;&lt;/u&gt;&lt;br /&gt;Failed Message Routing is a new feature of BizTalk 2006.&lt;br /&gt;You can read about it here: &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/bts06coredocs/html/d081934c-600e-44ce-8ba4-fb646d494589.asp"&gt;&lt;strong&gt;Using Failed Message Routing&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Below is an excerpt from the above help topic:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;What Does Failed Message Routing Consist Of?&lt;br /&gt;&lt;br /&gt;When failed message routing is enabled, BizTalk Server does not suspend the message—it routes the message instead. Failed message routing can be enabled on both receive and send ports, with the following results:&lt;br /&gt;If failed message routing is enabled on a receive port and a message fails in the receive pipeline or in routing, a failed message is generated. In the case where an error occurs in or before the disassembly phase, the error message is a clone of the original interchange. If failed message routing is enabled on a send port and the message fails in the send pipeline, a failed message is generated. When a failed message is generated, BizTalk Server promotes error-report-related message context properties and demotes regular message context properties before publishing the failed message. Compare this to the default behavior when failed message routing is not enabled: Messages that fail are suspended.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;There is much more information in the above article. I would highly recommend reading it. One of the properties promoted on a failed message is:&lt;/p&gt;
&lt;p&gt;ErrorReport.ErrorMessage = "FailedMessage"&lt;/p&gt;
&lt;p&gt;You can then subscribe to a failed message using a Send Port or Orchestration by filtering on the above property.&lt;/p&gt;
&lt;p&gt;&lt;u&gt;Failed Orchestrations Routing&lt;/u&gt;&lt;/p&gt;
&lt;p&gt;There is no such thing. If an orchestration suspends, the orchestration and its contained messages will become suspended. If you have an orchestration or send port with a filter such as:&lt;br /&gt;ErrorReport.ErrorMessage = "FailedMessage" &lt;/p&gt;
&lt;p&gt;It will not subscribe to the failed orchestration. No failed message is automatically generated that can be subscribed to on orchestration failure.&amp;nbsp;But, if you have set up a subscriber that is set up for Failed Message Routing and would like a message generated by the Failed Orchestration to be routed to the same subscriber, you can do the below:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1)&lt;/strong&gt; As below, add a scope shape and exception block in the orchestration to catch exceptions in the orchestration:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.objectsharp.com/blogs/matt/images/FailedMessageOrc.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2)&lt;/strong&gt; In the exception block construct a new message in the orchestration. While constructing the new message, promote the following property:&lt;/p&gt;
&lt;p&gt;msgError(ErrorReport.ErrorType) = "FailedMessage";&lt;/p&gt;
&lt;p&gt;See below for an example:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.objectsharp.com/blogs/matt/images/FailedMessageCreateMsg.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3)&lt;/strong&gt; As below, use the orchestration view to create the following Correlation Type. &lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.objectsharp.com/blogs/matt/images/FailedMessageCorrelationType.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4)&lt;/strong&gt; As below, use the orchestration view to create a Correlation Set that derives from the Correlation Type.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.objectsharp.com/blogs/matt/images/FailedMessageCorrelationSet.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;5)&lt;/strong&gt; As below add a Send shape to send out the newly constructed message. For the properties of the Send Shape, initialize the correlation set from 4). &lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.objectsharp.com/blogs/matt/images/FailedMessageInitializeCorrelationSet.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;6)&lt;/strong&gt; As below, link the send shape to a Logical Send port in the orchestration that will do a direct send into the messagebox.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.objectsharp.com/blogs/matt/images/FailedMessageDirectSend.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;7)&lt;/strong&gt; The ErrorReport.ErrorType is now promoted on the error message and you can now subscribe to it, using a filter condition as:&lt;/p&gt;
&lt;p&gt;ErrorReport.ErrorType = FailedMessage &lt;br /&gt;(if using a send port)&lt;br /&gt;Or:&lt;br /&gt;ErrorReport.ErrorType = "FailedMessage"&lt;br /&gt;(For a Receive Shape in an orchestration.)&lt;/p&gt;
&lt;p&gt;Note: You can also promote your own custom context property as described &lt;a href="http://realise-systems.net/blog/jsaull/archive/2004/12/08/557.aspx"&gt;&lt;strong&gt;Here&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;There is an example that you can download &lt;a href="http://www.objectsharp.com/blogs/matt/images/FailedOrchestrationRouting.zip"&gt;&lt;strong&gt;Here&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;. &lt;/strong&gt;Read the &lt;a href="http://www.objectsharp.com/blogs/matt/images/ReadMeFailedMessageOrc.txt"&gt;&lt;strong&gt;Readme&lt;/strong&gt;&lt;/a&gt; before installing.&lt;br /&gt;&lt;/p&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=4110" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>Dynamically Configuring Pipeline Component Properties in a BizTalk Orchestration</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2006/10/09/dynamically-configuring-pipeline-component-properties-in-a-biztalk-orchestration.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2006/10/09/dynamically-configuring-pipeline-component-properties-in-a-biztalk-orchestration.aspx</id><published>2006-10-09T20:04:00Z</published><updated>2006-10-09T20:04:00Z</updated><content type="html">&lt;P&gt;This&amp;nbsp;entry discusses the use of the following to programmatically alter a receive or send pipeline component(s) properties:&lt;/P&gt;
&lt;P&gt;BTS.SendPipelineConfig&lt;BR&gt;BTS.SendPipelineResponseConfig&lt;BR&gt;BTS.ReceivePipelineConfig&lt;BR&gt;BTS.ReceivePipelineResponseConfig&lt;/P&gt;
&lt;P&gt;There is a link at the end of this entry to download a couple of examples.&lt;/P&gt;
&lt;P&gt;Before discussing the above properties, two BizTalk 2006 pipeline enhancements are:&lt;/P&gt;
&lt;P&gt;1) The execution of send and receive pipelines in orchestrations. This &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/BTS06CoreDocs/html/a0f87f98-6f5f-4edb-8f65-49d22df5de97.asp"&gt;&lt;STRONG&gt;feature&lt;/STRONG&gt; &lt;/A&gt;allows a receive or send pipeline to be executed without the use of a physical receive or send port.&lt;BR&gt;2) Per Instance Pipeline Configuration using the BizTalk 2006 Administration Console. This allows changing the properties of receive and send pipeline components that &lt;BR&gt;are set in the various stages of receive and send pipelines. The receive and send pipelines are configured to be invoked in physical receive and send ports. For example, as below the MIME/SMIME decoder pipeline component configuration of a receive pipeline can be altered on a per instance basis using the BizTalk 2006 Administration tool.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/ConfigPipelineOrcPerInstance.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Both 1) and 2) are extremely useful features new for BizTalk 2006.&lt;/P&gt;
&lt;P&gt;An additional feature that would be useful (in some cases) would be to alter a pipelines component property values in an orchestration.&lt;/P&gt;
&lt;P&gt;As below the following properties may be set for a message in an orchestration.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Property&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;Type of Port&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTS.SendPipelineConfig&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Send Pipeline Configuration for a Two Way or One Way Send Port&amp;nbsp;&lt;BR&gt;BTS.SendPipelineResponseConfig&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Receive Pipeline Configuration for a Two Way Send Port&lt;/P&gt;
&lt;P&gt;BTS.ReceivePipelineConfig&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Receive Pipeline For a Two or One Way Receive Port&lt;BR&gt;BTS.ReceivePipelineResponseConfig&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Send Pipeline for a Two way Receive Port &lt;/P&gt;
&lt;P&gt;For the below receive pipeline configured with a MIME/SMIME decoder: &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/ConfigPipelineOrcMIMEReceive.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The below XML is used internally by BizTalk to store the above configuration:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/ConfigPipelineOrcMIMEReceiveConfig.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The above XML configuration can then be modified using a statement as below in a message assignment shape in an orchestration:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/ConfigPipelineOrcChangeConfig.jpg"&gt;&lt;/P&gt;
&lt;P&gt;When the above altered message is sent through a physical port that is set to use a receive pipeline configured&amp;nbsp; with the MIME/SMIME component (in the decode stage): &lt;BR&gt;The new configuration for the MIME/SMIME component (programmatically set in the orchestration) will then temporarily override the hardcoded configuration or the per-instance configuration pipelines configuration.&lt;/P&gt;
&lt;P&gt;Ideally this is useful to cut down on the number of pipelines or physical send or receive ports that have to be created. &lt;/P&gt;
&lt;P&gt;In order to use this method you can do the following:&lt;/P&gt;
&lt;P&gt;1) Create receive or send pipelines set with the appropriate pipeline components. Deploy the pipelines.&amp;nbsp; &lt;BR&gt;Note: You do not have to configure the pipeline components properties.&lt;BR&gt;Note: You can also use the out of the box XML Receive or Send pipelines.&lt;/P&gt;
&lt;P&gt;2) Create physical ports that are set to use the pipelines from 1).&lt;/P&gt;
&lt;P&gt;3) Create and deploy orchestrations that temporarily override the hardcoded or per-instance send or receive ports pipeline configuration as was illustrated in an above graphic.&lt;BR&gt;Logical ports in the orchestration are needed to send or receive the messages from an orchestration. The logical ports are then bound to physical ports. The configuration set in the orchestration will then temporarily override the configuration of the physical ports.&lt;/P&gt;
&lt;P&gt;Note: To get a sample of the configuration for a pipeline. Do the below:&lt;BR&gt;Using a tool such as Microsoft Sql Server Management Studio, query/open and copy the following values for a port created in 2), from a row in the following table.column in the BizTalkMgmtDB database: &lt;/P&gt;
&lt;P&gt;bts_sendport.nvcSendPipelineData&lt;BR&gt;bts_sendport.nvcReceivePipelineData&lt;BR&gt;adm_receivelocation.ReceivePipelineData&lt;BR&gt;adm_receivelocation.SendPipelineData&lt;/P&gt;
&lt;P&gt;Note: If the column/row for a port is null, using the BizTalk Console, edit the receive or send ports pipeline configuration so that it overrides&amp;nbsp;the default configuration. The configuration for the pipeline component(s) should then be set in one of the above table.column combinations. You can then revert back to the default configuration, by choosing the passthrough pipeline and then again choosing the original pipeline.&lt;BR&gt;&amp;nbsp;&lt;BR&gt;Note: Do not modify the contents of the rows/columns directly in the BizTalkMgmtDB database.&lt;BR&gt;Note. The BizTalk Object Model could also be used to retrieve the configurations.&lt;BR&gt;Note: The configuration for the pipeline can be stored and then retrieved from a configuration store (i.e. config file, SSO, database etc) and then set in the orchestration.&lt;/P&gt;
&lt;P&gt;4) Bind the logical ports in the deployed orchestrations from 3) to physical ports from 2).&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Good Things&lt;/U&gt;&lt;BR&gt;&lt;/STRONG&gt;1) This is a technique to cut down on the number of pipeline components and/or physical ports.&lt;BR&gt;For example if the same XML received message was to be delivered to the same file directory i.e. (C:\flatfiles) as a delimited and positional flat file,&lt;BR&gt;the following send ports, pipelines and orchestrations would be required: &lt;/P&gt;
&lt;P&gt;&lt;U&gt;Executing Send Pipelines in an Orchestration &lt;BR&gt;&lt;/U&gt;i) Send Pipeline with FlatFile Assembler component for delimited flat file.&lt;BR&gt;ii) Send Pipeline with FlatFile Assembler component for positional flat file.&lt;BR&gt;iii) Send Port configured with Passthrough pipeline.&lt;BR&gt;iv) Orchestration&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Per Instance Pipeline Configuration&lt;/U&gt;&lt;BR&gt;i) Send Pipeline with FlatFile Assembler.&lt;BR&gt;ii) Send Port with per instance configuration of above pipeline to create delimited flat file.&lt;BR&gt;iii) Send Port with per instance configuration of above pipeline to create positional flat file.&lt;BR&gt;iv) Optionally an orchestration.&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&lt;U&gt;Dynamically Configuring Pipeline Component Properties in a BizTalk Orchestration&lt;/U&gt;&lt;BR&gt;i) Send Pipeline with FlatFile Assembler.&lt;BR&gt;ii) Send Port configured to use above pipeline.&lt;BR&gt;iii) Orchestration&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;U&gt;Not So Good Things&lt;BR&gt;&lt;/U&gt;&lt;/STRONG&gt;1) To dynamically configure and execute a receive pipeline, a two way send port will have to be used. This might introduce the need for a loopback adapter. A loopback adapter also introduces messagebox hops that will degrade performance. &lt;BR&gt;2) Maintaining a store of the Pipeline configuration XML. The configuration store replaces individual pipeline components or per instance configuration of pipelines in a physical send or receive port.&lt;BR&gt;&lt;BR&gt;There are two examples included in the &lt;A href="http://www.objectsharp.com/blogs/matt/images/OrcConfigPipelineLoopBackAdapter.zip"&gt;&lt;STRONG&gt;download&lt;/STRONG&gt;&lt;/A&gt; :&lt;BR&gt;1) Orchestration sets receive pipeline configuration and uses a loopback adapter that executes altered configuration.&lt;BR&gt;2) Orchestration sets send pipeline configuration and uses send file adapter to invoke altered configuration.&lt;BR&gt;Note: A loopback adapter is also included in the download. Please read the &lt;A href="http://www.objectsharp.com/blogs/matt/images/OrcConfigPipelineReadme.txt"&gt;&lt;STRONG&gt;ReadMe&lt;/STRONG&gt;&lt;/A&gt; before installing&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;U&gt;Unfortunately&lt;BR&gt;&lt;/U&gt;&lt;/STRONG&gt;I wish you could do something like the below:&lt;/P&gt;
&lt;P&gt;OutputMessage(BTS.ReceivePipelineConfig) = "Pipeline Config XML would go here";&lt;BR&gt;OutputMessage = Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteReceivePipeline(typeof(PipelinesAndSchemas.ReceivePipeline), InputMessage);&lt;/P&gt;
&lt;P&gt;It did not produce a runtime error, but the configuration for the Receive Pipeline was not overridden.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Last of All&lt;BR&gt;&lt;/U&gt;&lt;/STRONG&gt;I have&amp;nbsp;yet to use this technique in a production environment. I have&amp;nbsp;not tried this technique&amp;nbsp;with pipelines configured to use multiple or custom components, but it should work with these scenarios. Please consider all the pros and cons of using this technique. Again, this could be an alternative to replace an unmanageable number of receive/send ports and pipelines.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=4099" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>Extending BizTalk Mapping/Transformation operations into Sql Server</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2006/07/19/extending-biztalk-mapping-transformation-operations-into-sql-server.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2006/07/19/extending-biztalk-mapping-transformation-operations-into-sql-server.aspx</id><published>2006-07-19T19:52:00Z</published><updated>2006-07-19T19:52:00Z</updated><content type="html">&lt;P&gt;A staple in BizTalk 2004/2006 is to design and implement mapping/transformation operations using the BizTalk mapper. Mapping in BizTalk can be extended and improved by:&lt;/P&gt;
&lt;P&gt;a) Using a rich set of &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_prog_map_djtt.asp"&gt;&lt;STRONG&gt;Functoids&lt;/STRONG&gt;&lt;/A&gt; that ship with BizTalk.&lt;BR&gt;b) Using custom &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_sdk_samples_xmltools_eprq.asp"&gt;&lt;STRONG&gt;XSLT&lt;/STRONG&gt;&lt;/A&gt; in a map.&lt;BR&gt;c) Writing &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_sdk_samples_xmltools_eprq.asp"&gt;&lt;STRONG&gt;Custom Functoids&lt;/STRONG&gt;&lt;/A&gt; that can be used in a map (link) &lt;BR&gt;d) Writing JScript,C# or VB.Net code in a &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_prog_map_iboo.asp"&gt;&lt;STRONG&gt;Scripting Functoid&lt;/STRONG&gt;&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;As mapping operations become more complex, Custom &lt;A href="http://objectsharp.com/blogs/matt/archive/2005/12/15/3668.aspx"&gt;&lt;STRONG&gt;XSLT&lt;/STRONG&gt;&lt;/A&gt; must often be used to perform the complete transformation or a portion of the transformation.&lt;BR&gt;&amp;nbsp;&lt;BR&gt;Unfortunately many developers do not know XSLT and in some cases do not have time to learn it. But, most developers do have Sql skills and are comfortable writing Sql Statements that join tables to produce a final result set.&lt;/P&gt;
&lt;P&gt;This post will discuss a transformation of a source XML message to a destination XML message using a Sql Server 2005 stored procedure. The code for this example can be downloaded at the end of this entry.&lt;/P&gt;
&lt;P&gt;A&amp;nbsp;portion of the source XML message for the transformation is as below.&lt;BR&gt;One or many Applicant nodes are submitted with the message. &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/ExtendMapToSql_SourceMsg.jpg"&gt;&lt;/P&gt;
&lt;P&gt;A brief description of the &amp;lt;Applicant&amp;gt; node for the above message is as below:&lt;BR&gt;1) &amp;lt;Applicant&amp;gt; nodes contain information such as &amp;lt;ApplicantId&amp;gt;,&amp;lt;FirstName&amp;gt;,&amp;lt;LastName&amp;gt;,&amp;lt;Sex&amp;gt;,&amp;lt;BirthCountryCode&amp;gt; etc.&lt;BR&gt;2) &amp;lt;Applicant&amp;gt; nodes contain 0 to many &amp;lt;NickName&amp;gt; Nodes.&lt;BR&gt;3) &amp;lt;Applicant&amp;gt; nodes contain &amp;lt;TestScore&amp;gt; nodes, that include the results of a test taken.&lt;BR&gt;4) &amp;lt;Applicant&amp;gt; nodes contain &amp;lt;RelationInfoToScores&amp;gt; Nodes that contain IDRefs to relate&amp;nbsp;the ApplicantId to the correct TestScores in the message. The red arrows in the above graphic illustrate the relation. &lt;/P&gt;
&lt;P&gt;The Destination XML message for the completed transformation is as below. A separate &amp;lt;ConcatenatedApplicantInfo&amp;gt; node is created for each &amp;lt;Applicant&amp;gt; node in the source message. Information for each Applicant is concatenated with a padding of 25 spaces between items.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/ExtendMapToSql_DestinationMsg.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The below Sql Server 2005 stored procedure will complete the transformation of the source message to the destination message. &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;USE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; [TransformationHelper]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;GO&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;/****** Object:&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;StoredProcedure [dbo].[Map_ApplicantHierarchical_To_ApplicantFlat]&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Script Date: 07/13/2006 17:25:26 ******/&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;SET&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;ANSI_NULLS&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;ON&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;GO&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;SET&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;QUOTED_IDENTIFIER&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;ON&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;GO&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;CREATE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;Proc&lt;/SPAN&gt; [dbo]&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;[Map_ApplicantHierarchical_To_ApplicantFlat]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;-- Parameter to Accept AllApplicantInfo XML message &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;-- from BizTalk.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;@ApplicantXML &lt;SPAN style="COLOR:blue;"&gt;xml&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;As&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;/*&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;@Applicant Temp table for Applicant Header Info &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;from AllApplicantInfo info XML message.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;*/&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;DECLARE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; @Applicant &lt;SPAN style="COLOR:blue;"&gt;Table&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ApplicantId &lt;SPAN style="COLOR:blue;"&gt;int&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;null,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;FirstName &lt;SPAN style="COLOR:blue;"&gt;varchar&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;20&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;null,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;LastName &lt;SPAN style="COLOR:blue;"&gt;varchar&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;20&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;null,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;MiddleName &lt;SPAN style="COLOR:blue;"&gt;varchar&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;20&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;null,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Sex &lt;SPAN style="COLOR:blue;"&gt;char&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;1&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;null,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;BirthCountryCode &lt;SPAN style="COLOR:blue;"&gt;int&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;null,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;BirthProvinceCode &lt;SPAN style="COLOR:blue;"&gt;int&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;null,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;BirthCountry &lt;SPAN style="COLOR:blue;"&gt;varchar&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;20&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;null,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;BirthProvince &lt;SPAN style="COLOR:blue;"&gt;varchar&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;20&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;null);&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;/*&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;Statement to shred Applicant Header Info from XML message&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;into @Applicant Temp table&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;*/&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;WITH&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;XMLNAMESPACES&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'http://Applicants'&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;as&lt;/SPAN&gt; ns0&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Insert&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;Into&lt;/SPAN&gt; @Applicant&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;ApplicantId&lt;SPAN style="COLOR:gray;"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;FirstName&lt;SPAN style="COLOR:gray;"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;LastName&lt;SPAN style="COLOR:gray;"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;MiddleName&lt;SPAN style="COLOR:gray;"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Sex&lt;SPAN style="COLOR:gray;"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;BirthCountryCode&lt;SPAN style="COLOR:gray;"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;BirthProvinceCode&lt;SPAN style="COLOR:gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Select&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; ShreddedApplicantInfoXML&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;nCol&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'@ApplicantId'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'int'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;ShreddedApplicantInfoXML&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;nCol&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;((&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'(FirstName)[1]'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'varchar(20)'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;ShreddedApplicantInfoXML&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;nCol&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;((&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'(LastName)[1]'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'varchar(20)'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;ShreddedApplicantInfoXML&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;nCol&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;((&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'(MiddleName)[1]'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'varchar(20)'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;ShreddedApplicantInfoXML&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;nCol&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;((&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'(Sex)[1]'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'char(1)'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;ShreddedApplicantInfoXML&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;nCol&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;((&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'(BirthCountryCode)[1]'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'int'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;ShreddedApplicantInfoXML&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;nCol&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;((&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'(BirthProvinceCode)[1]'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'int'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;From&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; @ApplicantXML&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;nodes &lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'/ns0:AllApplicants/Applicant/Information'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;as&lt;/SPAN&gt; ShreddedApplicantInfoXML&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;nCol&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Where&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; ShreddedApplicantInfoXML&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;nCol&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;((&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'(FirstName)[1]'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'varchar(20)'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;is&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;not&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;null&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;/* In below update statement Join to another table to get Country Name:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;Join CountryCodes&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;On Applicant.BirthCountryCode = CountryCodes.Id&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Replaces Database functoids.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;This increases performance as it cuts out the &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Database functoids that would make multiple round trips to &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;the database&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;*/&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;/* Also in below update statement Call Managed Code to get Province name&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;BirthProvince = dbo.GetProvince(Applicant.BirthCountryCode,Applicant.BirthProvinceCode)&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;This is like a scripting functoid or custom functoid in a BizTalk map.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;*/&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Update&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; @Applicant&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Set&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; BirthCountry &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; CountryCodes&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;BirthProvince &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; dbo&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;GetProvince&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;Applicant&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;BirthCountryCode&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt;Applicant&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;BirthProvinceCode&lt;SPAN style="COLOR:gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;From&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; @Applicant &lt;SPAN style="COLOR:blue;"&gt;as&lt;/SPAN&gt; Applicant&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;Join&lt;/SPAN&gt; CountryCodes&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;On&lt;/SPAN&gt; Applicant&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;BirthCountryCode &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; CountryCodes&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;Id&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;--Below is good for debugging purposes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;--Select * from @Applicant&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;/*&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;@NickNames Temp table for Info &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;from AllApplicantInfo info XML message.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;*/&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;DECLARE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; @NickNames &lt;SPAN style="COLOR:blue;"&gt;Table&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;ApplicantId &lt;SPAN style="COLOR:blue;"&gt;int&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;null,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;[Name] &lt;SPAN style="COLOR:blue;"&gt;varchar&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;20&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;null)&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;/*&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;Statement to shred Info from XML message&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;into @NickNames Temp table&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;*/&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;WITH&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;XMLNAMESPACES&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'http://Applicants'&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;as&lt;/SPAN&gt; ns0&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Insert&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;Into&lt;/SPAN&gt; @NickNames&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Select&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; NickNameXML&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;nCol&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'(../@ApplicantId)[1]'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'int'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;NickNameXML&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;nCol&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;((&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'(Name)[1]'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'varchar(20)'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; @ApplicantXML&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;nodes &lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'/ns0:AllApplicants/Applicant/Information/NickName'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;as&lt;/SPAN&gt; NickNameXML&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;nCol&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;--Below is good for debugging purposes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;--Select * from @NickNames&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;/*&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;@TestScores Temp table for Info &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;from AllApplicantInfo info XML message.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;*/&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Declare&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; @TestScores &lt;SPAN style="COLOR:blue;"&gt;Table&lt;/SPAN&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;TestScoreId &lt;SPAN style="COLOR:blue;"&gt;char&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;2&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;null,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Test &lt;SPAN style="COLOR:blue;"&gt;varchar&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;20&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;null,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Score &lt;SPAN style="COLOR:blue;"&gt;int&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;null);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;/*&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;Statement to shred Info from XML message&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;into @TestScores Temp table&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;*/&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;WITH&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;XMLNAMESPACES&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'http://Applicants'&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;as&lt;/SPAN&gt; ns0&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Insert&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;Into&lt;/SPAN&gt; @TestScores&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Select&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;TestScoresXML&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;nCol&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'(@TestScoreId)'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'char(2)'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;TestScoresXML&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;nCol&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;((&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'(Test)[1]'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'varchar(20)'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;TestScoresXML&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;nCol&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;((&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'(Score)[1]'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'int'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; @ApplicantXML&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;nodes &lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'/ns0:AllApplicants/Applicant/TestScores'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;as&lt;/SPAN&gt; TestScoresXML&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;nCol&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;--Below is good for debugging purposes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;--Select * from @TestScores&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;/*&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;@Relation Temp table for Info &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;from AllApplicantInfo info XML message.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;*/&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Declare&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; @Relation &lt;SPAN style="COLOR:blue;"&gt;Table&lt;/SPAN&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;ApplicantId &lt;SPAN style="COLOR:blue;"&gt;int&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;null,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;TestScoreId &lt;SPAN style="COLOR:blue;"&gt;char&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;2&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;null);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;/*&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;Statement to shred Info from XML message&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;into @TestScores Temp table&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;*/&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;WITH&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;XMLNAMESPACES&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'http://Applicants'&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;as&lt;/SPAN&gt; ns0&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Insert&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;Into&lt;/SPAN&gt; @Relation&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Select&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;RelationXML&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;nCol&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'(@ApplicantId)'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'int'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;RelationXML&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;nCol&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;((&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'@TestScoreId'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'char(2)'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; @ApplicantXML&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;nodes &lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'/ns0:AllApplicants/Applicant/RelateInfoToScores'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;as&lt;/SPAN&gt; RelationXML&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;nCol&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;--Below is good for debugging purposes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;--Select * from @Relation&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Declare&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; @FinalResults &lt;SPAN style="COLOR:blue;"&gt;Table&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;ApplicantID &lt;SPAN style="COLOR:blue;"&gt;int&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;not&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;null,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;ConcatenatedInfo &lt;SPAN style="COLOR:blue;"&gt;varchar&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;8000&lt;SPAN style="COLOR:gray;"&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Declare&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; @ApplicantId &lt;SPAN style="COLOR:blue;"&gt;int&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Declare&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; @ApplicantInfoText &lt;SPAN style="COLOR:blue;"&gt;varchar&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;8000&lt;SPAN style="COLOR:gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Declare&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; @NickNamesText &lt;SPAN style="COLOR:blue;"&gt;varchar&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;8000&lt;SPAN style="COLOR:gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Declare&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; @ScoresText &lt;SPAN style="COLOR:blue;"&gt;varchar&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;8000&lt;SPAN style="COLOR:gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;-- Below cursor will do the work of concatenating each Applicants&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;-- info together into one node.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Declare&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; cur_ApplicantRows &lt;SPAN style="COLOR:blue;"&gt;Cursor&lt;/SPAN&gt; Local Fast_Forward &lt;SPAN style="COLOR:blue;"&gt;For&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;SELECT&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; ApplicantId&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;@Applicant&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;OPEN&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; cur_ApplicantRows&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;FETCH&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; NEXT &lt;SPAN style="COLOR:blue;"&gt;FROM&lt;/SPAN&gt; cur_ApplicantRows &lt;SPAN style="COLOR:blue;"&gt;INTO&lt;/SPAN&gt; @ApplicantId&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;While&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:fuchsia;"&gt;@@Fetch_status&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; 0 &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;Begin&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;Set&lt;/SPAN&gt; @ApplicantInfoText &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="COLOR:red;"&gt;''&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;Set&lt;/SPAN&gt; @NickNamesText &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="COLOR:red;"&gt;''&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;Set&lt;/SPAN&gt; @ScoresText &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="COLOR:red;"&gt;''&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:red;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;Select&lt;/SPAN&gt; @ApplicantInfoText &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; FirstName &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt; &lt;SPAN style="COLOR:fuchsia;"&gt;space&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;25 &lt;SPAN style="COLOR:gray;"&gt;-&lt;/SPAN&gt; &lt;SPAN style="COLOR:fuchsia;"&gt;len&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;FirstName&lt;SPAN style="COLOR:gray;"&gt;))&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;+&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:8;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;LastName &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt; &lt;SPAN style="COLOR:fuchsia;"&gt;space&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;25 &lt;SPAN style="COLOR:gray;"&gt;-&lt;/SPAN&gt; &lt;SPAN style="COLOR:fuchsia;"&gt;len&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;LastName&lt;SPAN style="COLOR:gray;"&gt;))&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;+&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:8;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;MiddleName &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:fuchsia;"&gt;space&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;25 &lt;SPAN style="COLOR:gray;"&gt;-&lt;/SPAN&gt; &lt;SPAN style="COLOR:fuchsia;"&gt;len&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;MiddleName&lt;SPAN style="COLOR:gray;"&gt;))&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:8;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Sex &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:fuchsia;"&gt;space&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;5 &lt;SPAN style="COLOR:gray;"&gt;-&lt;/SPAN&gt; &lt;SPAN style="COLOR:fuchsia;"&gt;len&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;Sex&lt;SPAN style="COLOR:gray;"&gt;))&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;+&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:8;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;BirthCountry &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:fuchsia;"&gt;space&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;25 &lt;SPAN style="COLOR:gray;"&gt;-&lt;/SPAN&gt; &lt;SPAN style="COLOR:fuchsia;"&gt;len&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;BirthCountry&lt;SPAN style="COLOR:gray;"&gt;))&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:8;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;BirthProvince &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:fuchsia;"&gt;space&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;25 &lt;SPAN style="COLOR:gray;"&gt;-&lt;/SPAN&gt; &lt;SPAN style="COLOR:fuchsia;"&gt;len&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;BirthProvince&lt;SPAN style="COLOR:gray;"&gt;))&lt;/SPAN&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;From&lt;/SPAN&gt; @Applicant &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;Where&lt;/SPAN&gt; ApplicantId &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; @ApplicantId&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;Select&lt;/SPAN&gt; @NickNamesText &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; @NickNamesText &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt; [Name] &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt; &lt;SPAN style="COLOR:fuchsia;"&gt;space&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;25 &lt;SPAN style="COLOR:gray;"&gt;-&lt;/SPAN&gt; &lt;SPAN style="COLOR:fuchsia;"&gt;len&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;[Name]&lt;SPAN style="COLOR:gray;"&gt;))&lt;/SPAN&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;From&lt;/SPAN&gt; @NickNames&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;Where&lt;/SPAN&gt; ApplicantId &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; @ApplicantId&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;Select&lt;/SPAN&gt; @ScoresText &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; @ScoresText &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:6;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;TestScores&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;Test &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt; &lt;SPAN style="COLOR:fuchsia;"&gt;space&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;25 &lt;SPAN style="COLOR:gray;"&gt;-&lt;/SPAN&gt; &lt;SPAN style="COLOR:fuchsia;"&gt;len&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;TestScores&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;Test&lt;SPAN style="COLOR:gray;"&gt;))&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt 3in;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:fuchsia;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;rtrim&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:fuchsia;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;str&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;TestScores&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;Score&lt;SPAN style="COLOR:gray;"&gt;))&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt; &lt;SPAN style="COLOR:fuchsia;"&gt;space&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;25 &lt;SPAN style="COLOR:gray;"&gt;-&lt;/SPAN&gt; &lt;SPAN style="COLOR:fuchsia;"&gt;len&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:fuchsia;"&gt;rtrim&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:fuchsia;"&gt;str&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;TestScores&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;Score&lt;SPAN style="COLOR:gray;"&gt;))))&lt;/SPAN&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;From&lt;/SPAN&gt; @TestScores &lt;SPAN style="COLOR:blue;"&gt;as&lt;/SPAN&gt; TestScores&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;Join&lt;/SPAN&gt; @Relation &lt;SPAN style="COLOR:blue;"&gt;as&lt;/SPAN&gt; Relation&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;On&lt;/SPAN&gt; TestScores&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;TestScoreId &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; Relation&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;TestScoreId&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;and&lt;/SPAN&gt; Relation&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;ApplicantId &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; @ApplicantId&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:green;"&gt;--Select @NickNamesText&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:green;"&gt;--Select @ApplicantInfoText&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:green;"&gt;--Select @ScoresText&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;Insert&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;Into&lt;/SPAN&gt; @FinalResults&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;values&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;@ApplicantId&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt; @ApplicantInfoText &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt; &lt;SPAN style="COLOR:red;"&gt;' '&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt; @NickNamesText &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt; &lt;SPAN style="COLOR:red;"&gt;' '&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt; @ScoresText&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FETCH&lt;/SPAN&gt; NEXT &lt;SPAN style="COLOR:blue;"&gt;FROM&lt;/SPAN&gt; cur_ApplicantRows &lt;SPAN style="COLOR:blue;"&gt;INTO&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;@ApplicantId&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;End&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;-- Below statement will generate the Final Flat Applicant XML Result.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;-- Return back the final result set &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;Select&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; 1 &lt;SPAN style="COLOR:blue;"&gt;as&lt;/SPAN&gt; Tag&lt;SPAN style="COLOR:gray;"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;0 &lt;SPAN style="COLOR:blue;"&gt;as&lt;/SPAN&gt; Parent&lt;SPAN style="COLOR:gray;"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ApplicantID &lt;SPAN style="COLOR:blue;"&gt;as&lt;/SPAN&gt; [ConcatenatedApplicantInfo!1!ApplicantID]&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ConcatenatedInfo &lt;SPAN style="COLOR:blue;"&gt;as&lt;/SPAN&gt; [ConcatenatedApplicantInfo!1!!cdata] &lt;SPAN style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;From&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; @FinalResults &lt;SPAN style="COLOR:blue;"&gt;as&lt;/SPAN&gt; ConcatenatedApplicantInfo&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;FOR&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;XML&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;EXPLICIT&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;Discussion of Stored Procedure:&lt;/P&gt;
&lt;P&gt;1) The AllApplicantInfo source XML Message is passed to the stored procedure via a parameter of type XML.&lt;/P&gt;
&lt;P&gt;2) The AllApplicantInfo source XML Message is then shredded into an number of temporary relational tables:&lt;/P&gt;
&lt;P&gt;@Applicant&lt;BR&gt;@NickNames&lt;BR&gt;@TestScores&lt;BR&gt;@Relation&lt;/P&gt;
&lt;P&gt;3) Sql Statements in the stored procedure are used to join the temp tables to produce the final &amp;lt;ConcatenatedApplicantInfo&amp;gt; node for each &amp;lt;Applicant&amp;gt; node in the source message.&lt;/P&gt;
&lt;P&gt;4) The final destination message is returned using a Select statement via an XML Explicit Clause.&lt;/P&gt;
&lt;P&gt;5) The Country Code table is directly available and can be joined to in a set operation in the stored procedure. This eliminates using Database Functoids in a BizTalk Map that would invoke multiple round trips to Sql Server.&lt;/P&gt;
&lt;P&gt;6) A new feature of Sql Server 2005 is calling managed code. Managed code in Sql Server 2005 allows complex data manipulation that would be difficult to write using straight Transact SQL. In this example, calling managed code from stored procedure replaces the use of functoids in a BizTalk map. The below managed code was called from the stored procedure to determine the Province from a Province code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; System;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; System.Data;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; System.Data.SqlClient;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; System.Data.SqlTypes;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; Microsoft.SqlServer.Server;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;partial&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR:teal;"&gt;UserDefinedFunctions&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[Microsoft.SqlServer.Server.&lt;SPAN style="COLOR:teal;"&gt;SqlFunction&lt;/SPAN&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR:teal;"&gt;SqlString&lt;/SPAN&gt; GetProvince (&lt;SPAN style="COLOR:teal;"&gt;SqlInt32&lt;/SPAN&gt; country, &lt;SPAN style="COLOR:teal;"&gt;SqlInt32&lt;/SPAN&gt; province)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;string&lt;/SPAN&gt; result = &lt;SPAN style="COLOR:maroon;"&gt;""&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;switch&lt;/SPAN&gt; (country.Value)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;case&lt;/SPAN&gt; 1:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;switch&lt;/SPAN&gt; (province.Value) &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;case&lt;/SPAN&gt; 1:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;result = &lt;SPAN style="COLOR:maroon;"&gt;"Newfoundland"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;break&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;case&lt;/SPAN&gt; 2:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;result = &lt;SPAN style="COLOR:maroon;"&gt;"PEI"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;break&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;case&lt;/SPAN&gt; 3:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;result = &lt;SPAN style="COLOR:maroon;"&gt;"New Brunswick"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;break&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;case&lt;/SPAN&gt; 4:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;result = &lt;SPAN style="COLOR:maroon;"&gt;"Nova Scotia"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;break&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;case&lt;/SPAN&gt; 5:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;result = &lt;SPAN style="COLOR:maroon;"&gt;"Quebec"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;break&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;case&lt;/SPAN&gt; 6:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;result = &lt;SPAN style="COLOR:maroon;"&gt;"Ontario"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;break&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;case&lt;/SPAN&gt; 7:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;result = &lt;SPAN style="COLOR:maroon;"&gt;"Manitoba"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;break&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;case&lt;/SPAN&gt; 8:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;result = &lt;SPAN style="COLOR:maroon;"&gt;"Saskatchewan"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;break&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;case&lt;/SPAN&gt; 9:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;result = &lt;SPAN style="COLOR:maroon;"&gt;"Alberta"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;break&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;case&lt;/SPAN&gt; 10:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;result = &lt;SPAN style="COLOR:maroon;"&gt;"British Columbia"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;break&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;case&lt;/SPAN&gt; 11:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;result = &lt;SPAN style="COLOR:maroon;"&gt;"Yukon"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;break&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;case&lt;/SPAN&gt; 12:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;result = &lt;SPAN style="COLOR:maroon;"&gt;"NWT"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;break&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;default&lt;/SPAN&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;result = &lt;SPAN style="COLOR:maroon;"&gt;"Unknown"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;break&lt;/SPAN&gt;;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;break&lt;/SPAN&gt;;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;default&lt;/SPAN&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;result = &lt;SPAN style="COLOR:maroon;"&gt;"Unknown"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;break&lt;/SPAN&gt;;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;return&lt;/SPAN&gt; result;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-no-proof:yes;"&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P&gt;As below, BizTalk can invoke the stored procedure via the Sql Adapter passing the source message as a parameter and then receiving the destination message as the response.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/ExtendMapOrch.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Sql 2005 has added many enhancements to aid in XML processing.&lt;BR&gt;a) XQuery expressions&lt;BR&gt;An example is below:&lt;/P&gt;
&lt;P&gt;for $i in /InvoiceList/Invoice/Items/Item&lt;BR&gt;return &lt;BR&gt;{$i/@Quantity}&lt;BR&gt;{string($i/@Product)}&lt;/P&gt;
&lt;P&gt;b) Xml Auto -&amp;gt; Nesting XML auto clauses&lt;BR&gt;c) XML datatype&lt;BR&gt;d) Indexing xml data&lt;BR&gt;e) A subset of the FLWOR syntax&lt;BR&gt;f) Validating XML against a Schema.&lt;BR&gt;g) more..&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;If you are interested in some free online virtual labs that explore the new Sql 2005 XML capabilities, please click on the below links:&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032290423&amp;amp;EventCategory=3&amp;amp;culture=en-US&amp;amp;CountryCode=US"&gt;&lt;STRONG&gt;SQL Server™ 2005: XML Capabilities (TechNet) Virtual Lab&lt;/STRONG&gt;&lt;/A&gt;&lt;BR&gt;&lt;STRONG&gt;And:&lt;BR&gt;&lt;/STRONG&gt;&lt;A href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032291147&amp;amp;EventCategory=3&amp;amp;culture=en-US&amp;amp;CountryCode=US"&gt;&lt;STRONG&gt;Using Xquery with SQL Server 2005 XML Data (TechNet) Virtual Lab&lt;/STRONG&gt;&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;&lt;U&gt;&lt;STRONG&gt;Finally:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;The not so good things about this method:&lt;BR&gt;&lt;/U&gt;&lt;BR&gt;1) You have to call Sql server from BizTalk. When using BizTalk maps, the entire &lt;BR&gt;transformation is localized to the BizTalk host process.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;The good things about this method:&lt;BR&gt;&lt;/U&gt;&lt;BR&gt;1) Simplified debugging of the transformation. For example, in the T-SQL you can place in print statements, select statements that return intermediate result sets, debug a stored procedure in Visual Studio, use the Sql Profiler etc.&lt;BR&gt;2) In this example only a stored procedure needs to be deployed to a Sql Server database.&lt;BR&gt;3) In this example, no data is persisted to permanent Sql Server tables. Only temp tables are utilized in the stored procedure.&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&lt;U&gt;Use this method:&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;1) As an alternative to writing custom XSLT.&lt;BR&gt;2) If you are comfortable writing Sql Server Stored Procedures.&lt;BR&gt;3) To replace database functoids in a map that incur multiple round trips to a database.&lt;BR&gt;4) To perform transformations on &lt;A href="http://objectsharp.com/blogs/matt/archive/2005/08/31/3209.aspx"&gt;&lt;STRONG&gt;larger messages&lt;/STRONG&gt;&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;&lt;U&gt;Some notes:&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;1) More than one XML message can be passed to a stored procedure.&lt;BR&gt;2) Transformation operations can be split between the BizTalk maps and stored procedures. For example BizTalk maps can carry out a portion of the transformation and then pass the remainder of the transformation to the stored procedures.&lt;BR&gt;3) For Sql 2000, OpenXML statements can be used to shred XML nodes into relational tables.&lt;BR&gt;&lt;BR&gt;&lt;U&gt;Conclusion: &lt;/U&gt;&lt;/P&gt;
&lt;P&gt;Use the new XML enhancements along with the managed code in Sql 2005 to simplify and to improve the performance of complex BizTalk mapping operations.&lt;/P&gt;
&lt;P&gt;Download the sample discussed above &lt;A href="http://www.objectsharp.com/blogs/matt/images/BtsTransformationHelper.zip"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;. Read the &lt;A href="http://www.objectsharp.com/blogs/matt/images/BtsTransHelperReadMe.txt"&gt;&lt;STRONG&gt;ReadMe.Txt&lt;/STRONG&gt;&lt;/A&gt; before installing and running.&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=4088" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>More Adapters from Jesús and Webcasts.</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2006/04/19/4057.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2006/04/19/4057.aspx</id><published>2006-04-19T12:26:00Z</published><updated>2006-04-19T12:26:00Z</updated><content type="html">&lt;P&gt;Jes&amp;#250;s&amp;nbsp;has been very busy building adapters.&amp;nbsp;They include:&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;SalesForce.com adapter for BizTalk Server 2006 &lt;BR&gt;Web Services Enhancements (WSE) 3.0 adapter for BizTalk Server 2006 &lt;BR&gt;SQL Server Service Broker adapter for BizTalk Server 2006 v1.5 &lt;BR&gt;&lt;/P&gt;
&lt;P&gt;A Webcast on the SalesForce Adapter will be given tomorrow (April 20), and a Webcast on the WSE 3.0 adapter will be given on May 5. You can read more about the adapters and Webcasts &lt;A href="http://weblogs.asp.net/gsusx/archive/2006/04/18/443275.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=4057" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author></entry><entry><title>BizTalk 2006 RTM ready for Download</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2006/03/27/4055.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2006/03/27/4055.aspx</id><published>2006-03-27T23:29:00Z</published><updated>2006-03-27T23:29:00Z</updated><content type="html">&lt;P&gt;The RTM version of BizTalk 2006 is now available for download on MSDN. &lt;BR&gt;Read more about the RTM version&amp;nbsp;&lt;A href="http://blogs.msdn.com/biztalk_server_team_blog/archive/2006/03/27/Michael.aspx"&gt;&lt;STRONG&gt;Here&lt;/STRONG&gt; &lt;/A&gt;and &lt;A href="http://blogs.msdn.com/ahamza/archive/2006/03/27/BizTalk_2006_RTM.aspx"&gt;&lt;STRONG&gt;Here&lt;/STRONG&gt;&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=4055" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author></entry><entry><title>Another BizTalk Presentation</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2006/03/27/4054.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2006/03/27/4054.aspx</id><published>2006-03-27T14:39:00Z</published><updated>2006-03-27T14:39:00Z</updated><content type="html">&lt;P&gt;I always forget to post these in advance.&lt;/P&gt;
&lt;P&gt;I am doing another BizTalk Presentation at Btug, tomorrow night (March 28) in Toronto.&lt;/P&gt;
&lt;P&gt;It is split into two parts:&lt;BR&gt;i)Handling Large Messages in BizTalk &lt;BR&gt;ii)Extending BizTalk Transformations into Sql Server&lt;/P&gt;
&lt;P&gt;Also ObjectSharp will be giving away a free seat for&amp;nbsp;a 5 day course -&amp;gt;&amp;nbsp;&lt;A href="http://objectsharp.com/blogs/matt/archive/2005/11/30/3639.aspx"&gt;&lt;STRONG&gt;Building BizTalk 2006 Solutions Best Practices&lt;/STRONG&gt;&lt;/A&gt; with the first delivery of the course slated for May 1 2006. You can read more about the presentation &lt;A href="http://www.objectsharp.com/oNewsUpdate/ReadingFullStory.aspx?StoryNum=-99"&gt;&lt;STRONG&gt;Here&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=4054" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author></entry><entry><title>Presentation -&gt; Using BizTalk 2006</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2006/02/08/3828.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2006/02/08/3828.aspx</id><published>2006-02-09T02:51:00Z</published><updated>2006-02-09T02:51:00Z</updated><content type="html">&lt;P&gt;Short notice, but I am doing a presentation tomorrow (Thurs. Feb 9)&amp;nbsp;at the&amp;nbsp;Metro Toronto .Net Users Group.&lt;BR&gt;You can read more about it here:&lt;BR&gt;&lt;A href="http://www.metrotorontoug.com/User+Group+Events/231.aspx"&gt;http://www.metrotorontoug.com/User+Group+Events/231.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Demos will include dealing with binary documents (Word and Excel) in BizTalk 2006.&lt;BR&gt;The demos will also include:&lt;BR&gt;&lt;BR&gt;- The new Sharepoint and POP3 adapters for BizTalk 2006.&lt;BR&gt;- Parsing Excel documents to XML in BizTalk.&lt;BR&gt;- Integration of Sql Server 2005 Service Broker&amp;nbsp;with BizTalk 2006.&lt;BR&gt;- Some of the new and improved features of BizTalk 2006.&lt;BR&gt;&lt;BR&gt;So if you are in the area, feel free to drop by.&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=3828" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>BizTalk 2006 -&gt; Example using the new POP3 and Sharepoint Adapters</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2006/02/03/3801.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2006/02/03/3801.aspx</id><published>2006-02-03T17:45:00Z</published><updated>2006-02-03T17:45:00Z</updated><content type="html">&lt;P&gt;Below is an example using the new POP3 and Sharepoint Adapters (Sharepoint Adapter now out of the box) for BizTalk 2006. This example demonstrates the following:&lt;/P&gt;
&lt;P&gt;1) Processing binary documents in BizTalk.&lt;BR&gt;2) A method to process multiple attachments in an incoming mail message.&lt;BR&gt;3) Improvements to the Sharepoint Adapter.&lt;/P&gt;
&lt;P&gt;You can download the code at the end of this blog.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;The example goes something like this.&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;A candidate is applying for a job. The candidates resume (Word) and an informational spreadsheet (Excel) are attached to an email message as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/POP3AndSharepointMailMessage.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The resume is in word format, and the excel spreadsheet is as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/POP3AndSharepointExcelInfo.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The mail message with attachments is read by BizTalk server. BizTalk server will then add a new item to a Sharepoint Document library. The Word document from the mail message is added as the item's document and the Excel spreadsheet is parsed to populate the First Name and Last Name columns as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/POP3AndSharepointDocLib.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;The sample works as below:&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;1) A BizTalk Receive Port/Receive Location is configured using the POP3 receive Adapter as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/POP3AndSharepointPOPRecLoc.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Note: The Apply MIME Decoding property is set to false. This is because we want the raw MIME message to be delivered to an orchestration. The two attachments of the message will be dealt with in the orchestration (see below).&lt;/P&gt;
&lt;P&gt;2) An orchestration as below will then subscribe to the incoming encoded MIME message:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/POP3AndSharepointOrch.jpg"&gt;&lt;/P&gt;
&lt;P&gt;3) In the orchestration, a receive pipeline (ConstructCandidateInfo Construct Shape) is executed to extract the Excel message out of the encoded MIME&amp;nbsp;message and to also parse the Excel message to an XML format.&lt;/P&gt;
&lt;P&gt;The pipeline looks as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/POP3AndSharepointExcelPipe.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Note: A MIME decoder is used in the pipeline to extract out the Excel Attachment&lt;BR&gt;Note: The &lt;A href="http://objectsharp.com/blogs/matt/archive/2006/01/29/3778.aspx"&gt;&lt;STRONG&gt;ODBC File decoder&lt;/STRONG&gt; &lt;/A&gt;&amp;nbsp;is used in the pipeline to parse the Excel Attachment to an&amp;nbsp; XML message. This is so the FirstName and LastName can be used to populate the First Name and Last Name columns in the Sharepoint document library list.&lt;BR&gt;Note: Executing receive pipelines in an orchestration is a new feature for BizTalk 2006.&lt;/P&gt;
&lt;P&gt;The code to execute the pipeline in the orchestration is as below:&lt;/P&gt;
&lt;P&gt;// Execute the Pipeline -&amp;gt; ReceivePipelineCandidateInfo.&lt;BR&gt;// This will create a message with the XML in it&lt;BR&gt;varPipelineOutPutMessages =&amp;nbsp; &lt;BR&gt;Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteReceivePipeline(typeof(BizTalkPop3AndSharepointExample.ReceivePipelineCandidateInfo),&amp;nbsp; &lt;BR&gt;msgMimeCandidate);&lt;BR&gt;msgCandidateInfo = null;&lt;BR&gt;varPipelineOutPutMessages.MoveNext();&lt;BR&gt;varPipelineOutPutMessages.GetCurrent(msgCandidateInfo);&lt;BR&gt;&amp;nbsp;&lt;BR&gt;4) In the orchestration, a receive pipeline (ConstructResume Construct Shape) is executed to extract the Word document.&lt;/P&gt;
&lt;P&gt;The pipeline looks as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/POP3AndSharepointWordPipe.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Note: A MIME decoder is used in the pipeline to extract out the Word Attachment&lt;/P&gt;
&lt;P&gt;The code to execute the pipeline in the orchestration is as below:&lt;/P&gt;
&lt;P&gt;// Execute the Pipeline -&amp;gt; ReceivePipelineCandidateResume.&lt;BR&gt;// This will create a message with the Word Document in it&lt;BR&gt;varPipelineOutPutMessages =&amp;nbsp; &lt;BR&gt;Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteReceivePipeline(typeof(BizTalkPop3AndSharepointExample.ReceivePipelineCandidateResume),&amp;nbsp; &lt;BR&gt;msgMimeCandidate);&lt;BR&gt;msgCandidateResume = null;&lt;BR&gt;varPipelineOutPutMessages.MoveNext();&lt;BR&gt;varPipelineOutPutMessages.GetCurrent(msgCandidateResume);&lt;/P&gt;
&lt;P&gt;// Get the FirstName and LastName that are in the Parsed XML Excel message.&lt;BR&gt;// set these into the WSS ConfigPropertiesXml&lt;BR&gt;varXmlDomCandidateInfo = msgCandidateInfo;&lt;BR&gt;varXmlNode = varXmlDomCandidateInfo.SelectSingleNode("//FirstName");&lt;BR&gt;strFirstName = varXmlNode.InnerText;&lt;BR&gt;varXmlNode = varXmlDomCandidateInfo.SelectSingleNode("//LastName");&lt;BR&gt;strLastName = varXmlNode.InnerText;&lt;BR&gt;// Set the first names and last names so they will &lt;BR&gt;// appear in the Document Library Columns&lt;BR&gt;strWSSConfigPropertiesXml = "&amp;lt;ConfigPropertiesXml&amp;gt;&amp;lt;PropertyName1&amp;gt;First Name&amp;lt;/PropertyName1&amp;gt;&amp;lt;PropertySource1&amp;gt;" + strFirstName +&amp;nbsp; &lt;BR&gt;"&amp;lt;/PropertySource1&amp;gt;&amp;lt;PropertyName2&amp;gt;Last Name&amp;lt;/PropertyName2&amp;gt;&amp;lt;PropertySource2&amp;gt;" + strLastName + "&amp;lt;/PropertySource2&amp;gt;&amp;lt;/ConfigPropertiesXml&amp;gt;";&lt;BR&gt;msgCandidateResume(WSS.ConfigPropertiesXml) = strWSSConfigPropertiesXml;&lt;BR&gt;// Set the name of the File, when created in the Sharepoint Document Library&lt;BR&gt;msgCandidateResume(WSS.Filename) = strFirstName + " "&amp;nbsp; + strLastName + ".doc";&lt;/P&gt;
&lt;P&gt;Note: msgCandidateResume(WSS.ConfigPropertiesXml) = strWSSConfigPropertiesXml; &lt;BR&gt;is used to set the First Name and Last Name columns in the document library.&lt;/P&gt;
&lt;P&gt;5) The msgCandidateResume message is then sent to the WSS library via a configured &lt;BR&gt;Send Port using the Sharepoint Adapter as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/POP3AndSharepointWSSSendPort.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Note: That the Column 01, Column 01 Value, Column 02, Column 02 Value, FileName are not configured.&lt;BR&gt;These are dynamically set by the orchestration as explained in 4).&lt;/P&gt;
&lt;P&gt;You can download the code &lt;A href="http://www.objectsharp.com/blogs/matt/images/Pop3AndSharepointExample.zip"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;. Also look at the &lt;A href="http://www.objectsharp.com/blogs/matt/images/Pop3SharepointReadme.txt"&gt;&lt;STRONG&gt;ReadMe&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Conclusion&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;1) The new adapters and adapter enhancements for BizTalk 2006 really open up the doors for integrating all sorts of different applications. For a complete list of adapters that will be shipped with BizTalk 2006, please go &lt;A href="http://www.microsoft.com/biztalk/2006/howtobuy/pricing.mspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;&amp;nbsp;&amp;nbsp; &lt;BR&gt;2) You can use the new features of BizTalk 2006 (like executing Receive Pipelines in an Orchestration), to easily process complex messages in BizTalk.&lt;BR&gt;3) Adrian Hamza and his team have developed a top notch, feature rich Sharepoint adapter for BizTalk 2006. For more information on the Sharepoint adapter, please visit Adrian's blog &lt;A href="http://blogs.msdn.com/ahamza/"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;. Adrian also has recorded a series of WebCasts on the Sharepoint Adapter: &lt;/P&gt;
&lt;P&gt;WSS Adapter Training Videos: &lt;/P&gt;
&lt;P&gt;WSSAdapter-PropsInOrchestration.wmv (28.58 MB) &lt;BR&gt;WSSAdapter-SendReceiveCBR.wmv (10.25 MB) &lt;BR&gt;WSSAdapter-SetupAndConfig-Short.wmv (9.58 MB) &lt;BR&gt;WSSAdapter-InfoPathIntegration.wmv (15.11 MB) &lt;/P&gt;
&lt;P&gt;You can download these at BetaPlace (BizTalk Server 2006 section)&lt;BR&gt;&lt;A href="http://beta.microsoft.com/"&gt;http://beta.microsoft.com&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;To get access to the BizTalk Server 2006 area at BetaPlace, please goto :&lt;BR&gt;&lt;A href="http://www.microsoft.com/biztalk/evaluation/bts2006beta.mspx"&gt;http://www.microsoft.com/biztalk/evaluation/bts2006beta.mspx&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=3801" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>BizTalk 2006 and the Sql Server 2005 Service Broker Adapter (Beta 2) </title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2006/01/04/3696.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2006/01/04/3696.aspx</id><published>2006-01-05T01:33:00Z</published><updated>2006-01-05T01:33:00Z</updated><content type="html">&lt;P&gt;Jes&amp;#250;s Rodr&amp;#237;guez has&amp;nbsp;finished&amp;nbsp;a Beta 2 version of&amp;nbsp; Service Broker Enhancements Adapter for BizTalk Server 2006. They are looking for beta testers, so please go &lt;A href="http://weblogs.asp.net/gsusx/archive/2006/01/04/434503.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt; if interested. &lt;A href="http://msdn2.microsoft.com/en-us/library/ms166043(en-us,SQL.90).aspx"&gt;&lt;STRONG&gt;Service Broker &lt;/STRONG&gt;&lt;/A&gt;is an exciting new feature for Microsoft SQL Server 2005.&amp;nbsp;Now you can&amp;nbsp;integrate BizTalk Messaging with Service Broker Messaging, using this important new adapter.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://weblogs.asp.net/gsusx/archive/2006/01/04/434503.aspx"&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=3696" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>BizTalk, Another Custom XSLT mapping sample.</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2005/12/15/3668.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2005/12/15/3668.aspx</id><published>2005-12-16T02:30:00Z</published><updated>2005-12-16T02:30:00Z</updated><content type="html">&lt;P&gt;The below mapping example could most likely be accomplished using a series of BizTalk maps. In the maps,&amp;nbsp; Table Looping / Table Extractor / Looping functoids etc. could be used to perform the transformation. Sometimes it makes sense to craft your own custom XSLT to execute the complete transformation.&amp;nbsp;The sample input / output messages for the transformation&amp;nbsp;as below. Also included is the custom XSLT for the transformation. You can also download the source code (at end of this blog entry).&amp;nbsp; &lt;/P&gt;
&lt;P&gt;INPUT Message:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/AnotherCustomXSLTInputMessage.jpg"&gt;&lt;/P&gt;
&lt;P&gt;--&amp;gt; For each "contenedor" node, in the output message must repeat the sequence of segments ORC + RQD (According to the standard HL7 v.2.3.1)&lt;BR&gt;--&amp;gt; For each "prueba" node, in the output message must repeat the sequence of segments ORC + OBR&lt;BR&gt;--&amp;gt; For each "parametro" node, in the output message must repeat the segment NTE&lt;/P&gt;
&lt;P&gt;For the below output, the order of the nodes is also important. The order relates back to the input message.&lt;/P&gt;
&lt;P&gt;OUTPUT Message should be:&lt;/P&gt;
&lt;P&gt;MSH||||.|&lt;BR&gt;ORC||||.|&lt;BR&gt;RQD||||.|&lt;BR&gt;ORC||||.|&lt;BR&gt;RQD||||.|&lt;BR&gt;ORC||||.|&lt;BR&gt;OBR||||.|&lt;BR&gt;NTE||||.|&lt;BR&gt;NTE||||.|&lt;BR&gt;ORC||||.|&lt;BR&gt;OBR||||.|&lt;BR&gt;NTE||||.|&lt;BR&gt;NTE||||.|&lt;BR&gt;NTE||||.|&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;The custom XSLT for the mapping/transformation looks like below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/AnotherCustomXSLTTheXSLT.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The above XSLT can be placed in a scripting functoid in the map as discussed &lt;A href="http://objectsharp.com/blogs/matt/archive/2004/11/24/1031.aspx"&gt;&lt;STRONG&gt;HERE&lt;BR&gt;&lt;/STRONG&gt;&lt;/A&gt;Or the custom XSLT can be placed in a separate file, with the map's property -&amp;gt;&amp;nbsp; Custom XSLT Path pointing to the file (see below)&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/AnotherCustomXSLTCustomPath.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Download the solution &lt;A href="http://www.objectsharp.com/blogs/matt/images/AnotherCustomXSLTCode.zip"&gt;&lt;STRONG&gt;HERE&lt;BR&gt;&lt;BR&gt;&lt;/STRONG&gt;&lt;/A&gt;Conclusion: In some cases it is much simpler to write your own custom XSLT for a BizTalk map. &lt;BR&gt;Note: You can also perform a transformation in a BizTalk map using a combination of custom XSLT and links/functoids (see below links)&lt;BR&gt;Note: Using functoids or a combination of functoids in a map are sometimes not enough to perform a transformation or a portion of a transformation. Using custom XSLT for the transformation or a portion of the transformation may be the answer.&lt;BR&gt;&lt;BR&gt;Below is more information on using custom XSLT in BizTalk maps:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_sdk_samples_xmltools_eprq.asp"&gt;&lt;STRONG&gt;Extending Mapper (BizTalk Server SDK Samples)&lt;/STRONG&gt;&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;&lt;A href="http://geekswithblogs.net/sthomas/archive/2004/10/28/13982.aspx"&gt;&lt;STRONG&gt;Creating Nodes from Flat Data in BizTalk 2004 Maps &lt;/STRONG&gt;&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;&lt;A href="http://codebetter.com/blogs/jeff.lynch/articles/128664.aspx"&gt;&lt;STRONG&gt;Logical Message Splitting in BizTalk Server 2004 &lt;/STRONG&gt;&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;&lt;A href="http://geekswithblogs.net/synboogaloo/archive/2005/04/22/37335.aspx"&gt;&lt;STRONG&gt;Implementation of Message Transformation Normaliser Pattern in the BizTalk 2004&lt;/STRONG&gt; &lt;/A&gt;&lt;BR&gt;&lt;BR&gt;&lt;A href="http://bloggingabout.net/blogs/wellink/archive/2005/06/22/6951.aspx"&gt;&lt;STRONG&gt;Sorting XML Nodes with the BizTalk Mapper&lt;/STRONG&gt;&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;&lt;A href="http://www.masteringbiztalk.com/blogs/jon/PermaLink,guid,bc5e05f0-659f-4ace-a6fe-d864cdf1fbe2.aspx"&gt;&lt;STRONG&gt;Debugging XSLT&lt;/STRONG&gt; &lt;/A&gt;&lt;BR&gt;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=3668" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>New BizTalk 2006 5 day Course -&gt; Building BizTalk 2006 Solutions Best Practices</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2005/11/30/new-biztalk-2006-5-day-course-building-biztalk-2006-solutions-best-practices.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2005/11/30/new-biztalk-2006-5-day-course-building-biztalk-2006-solutions-best-practices.aspx</id><published>2005-11-30T17:35:00Z</published><updated>2005-11-30T17:35:00Z</updated><content type="html">&lt;P&gt;I am in the process of writing a new BizTalk 2006 course as below:&lt;/P&gt;
&lt;P&gt;Preamble&lt;/P&gt;
&lt;P&gt;BizTalk is all about messaging and how messages are processed and routed between a companies internal applications (for example: Sap/Mainframe/Peoplesoft/ Database/JD Edwards/Web Services etc.) and how messages are exchanged with trading partners (B2B). BizTalk provides an excellent framework for implementing many common&amp;nbsp;messaging patterns such as:&lt;BR&gt;a) Scatter/Gatherer pattern &lt;BR&gt;b) Splitter pattern&lt;BR&gt;c) Aggregator pattern&lt;BR&gt;d) Message Broker pattern&lt;BR&gt;e) etc.&lt;BR&gt;The objective of this course is to provide students with all the necessary tools to implement messaging patterns using BizTalk 2006.&lt;/P&gt;
&lt;P&gt;Below are some of the topics with labs for the course:&lt;/P&gt;
&lt;P&gt;a) Various methods to Create Schemas for XML and Flat files messages.&lt;BR&gt;b) Mapping using the BizTalk Mapper, custom XSLT and other alternatives &lt;BR&gt;will be discussed to perform complex transformations.&lt;BR&gt;c) An introduction into building Custom Adapters&lt;BR&gt;d) An introduction into building Custom Pipeline Components&lt;BR&gt;e) Interacting with the BizTalk Messaging Engine&lt;BR&gt;f) Creating and using Custom Pipelines&lt;BR&gt;g) Orchestrations.&lt;BR&gt;h) Using xpath in Orchestrations.&lt;BR&gt;i) Web Services and BizTalk&lt;BR&gt;j) Error Handling with BizTalk&lt;BR&gt;k) Debugging BizTalk Solutions&lt;BR&gt;l) Deploying BizTalk Solutions&lt;BR&gt;m) Business Activity Monitoring and BizTalk&lt;BR&gt;n) Business Rules Engine&lt;BR&gt;o) Implementing Common Enterprise Integration Patterns with BizTalk.&lt;BR&gt;Some of the patterns discussed and put into practice are:&lt;BR&gt;Message Broker&lt;BR&gt;Content Based Routing&lt;BR&gt;Splitter Pattern&lt;BR&gt;Normalizer Pattern&lt;BR&gt;Aggregator Pattern&lt;BR&gt;&amp;nbsp;&lt;BR&gt;Additionally the new features of BizTalk 2006 will be highlighted and used in Labs.&lt;/P&gt;
&lt;P&gt;It is quite a bit for a five day course (not sure if all of it will make it in). From my experience using the product and teaching a BTS 2004 course for the past year and a half,&amp;nbsp;the above is what I would like to cover in the course.&lt;/P&gt;
&lt;P&gt;If you have a suggestion for additional topics for the course, please reply to this entry. I would love to hear them.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Update&lt;/STRONG&gt;: This course is available now. &lt;A class="" title="Building BizTalk Server 2006 Solutions Best Practices" href="http://objectsharp.com/training/CourseDetail.aspx?id=1300"&gt;Building BizTalk Server 2006 Solutions Best Practices&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=3639" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>BizTalk, MIB, Acord and 5 minutes of Marketing</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2005/11/28/3634.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2005/11/28/3634.aspx</id><published>2005-11-28T17:21:00Z</published><updated>2005-11-28T17:21:00Z</updated><content type="html">&lt;P&gt;My blog entries are usually technical in nature. This entry is more of a marketing entry discussing how BizTalk 2004/2006 can be used to implement the following specific business scenario:&lt;/P&gt;
&lt;P&gt;1) An insurance underwriter requires information (for example -&amp;gt; medical history) about an insurance applicant.&lt;/P&gt;
&lt;P&gt;2) An internal application captures applicant information provided by the underwriter such as:&lt;BR&gt;a) Applicants First Name/Last Name/ Middle Name.&lt;BR&gt;b) Birth date.&lt;BR&gt;c) Birth place.&lt;/P&gt;
&lt;P&gt;3) The internal application then sends this information to a company called &lt;A href="http://www.mib.com/"&gt;&lt;STRONG&gt;MIB&lt;/STRONG&gt;&lt;/A&gt;. The underwriters query parameters (Last Name/ First Name etc) are then used to query a data repository at MIB. A result set of the query is then returned to the internal application from MIB. This result set contains information such as the medical history of the applicant. &lt;/P&gt;
&lt;P&gt;4) The results from MIB are then displayed to the insurance underwriter to aid in the insurance application process.&lt;/P&gt;
&lt;P&gt;Presently many North American insurance companies send/receive information to/from MIB over a dial up connection. Flat Files are sent and received back from MIB.&lt;/P&gt;
&lt;P&gt;By December of 2006, all users of the current dial up process are to switch over to a new process provided by MIB as below:&lt;/P&gt;
&lt;P&gt;All insurance underwriter requests are to be transmitted to MIB using a secure HTTP connection. The requests are to be sent in XML messages that conform to the &lt;A href="http://www.acord.org/Standards/lifexml.aspx"&gt;&lt;STRONG&gt;Acord&lt;/STRONG&gt;&lt;/A&gt; schemas. A synchronous HTTP response (XML) message will then be sent back over the same secure HTTP channel as the request. This response message contains the results of the query.&lt;/P&gt;
&lt;P&gt;Below is a description of how the above new process can be implemented by BizTalk 2004 or BizTalk 2006.&lt;/P&gt;
&lt;P&gt;1) Create a new BizTalk project that contains the Acord XSD schemas as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/BizTalkMIBAcordSchemaProjects.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;2) Typically a mainframe application may dump the underwriter requests to disk in a flat file or different format.&lt;BR&gt;A configured BizTalk FTP or File Receive Port is then configured to pick up the files. &lt;BR&gt;&amp;nbsp;&lt;BR&gt;Note: The original request may be delivered by a different transport or stored to intermediate location as below:&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;HTTP&lt;BR&gt;MSMQ&lt;BR&gt;MQSeries&lt;BR&gt;Sql Server&lt;BR&gt;Oracle&lt;BR&gt;DB2&lt;BR&gt;Host Applications&amp;nbsp; -&amp;gt; IBM, mainframe zSeries (CICS and IMS) and/or midrange iSeries (RPG)&lt;BR&gt;Host Files -&amp;gt; Data adapter for host file systems on IBM mainframe zSeries VSAM datasets and midrange iSeries physical files&lt;BR&gt;etc. &lt;/P&gt;
&lt;P&gt;&lt;BR&gt;BizTalk contains many out of the box &lt;A href="http://www.microsoft.com/biztalk/2006/howtobuy/pricing.mspx"&gt;&lt;STRONG&gt;adapters&lt;/STRONG&gt;&lt;/A&gt; that can be used to receive messages from all the above transports/locations and others not listed. If the needed adapter is not provided out of the box, then the BizTalk Adapter framework can be used to author your own custom adapter. Third party adapters can also be purchased.&lt;/P&gt;
&lt;P&gt;3) Create internal XSD schemas to represent the internal messages.&lt;BR&gt;For example, an XSD schema using flat file extensions would be created&amp;nbsp; to represent flat files produced by the mainframe application.&lt;/P&gt;
&lt;P&gt;4) Create BizTalk &lt;A href="http://www.microsoft.com/biztalk/evaluation/overview/screen_2.htm"&gt;&lt;STRONG&gt;map(s)&lt;/STRONG&gt;&lt;/A&gt; to transform the internal flat files to Acord XML messages.&lt;/P&gt;
&lt;P&gt;5) Create the necessary BizTalk &lt;A href="http://www.microsoft.com/biztalk/evaluation/overview/screen_3.htm"&gt;&lt;STRONG&gt;orchestrations&lt;/STRONG&gt;&lt;/A&gt; for the business process.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;6) Install a certificate on the BizTalk machine for the MIB secure HTTP requests using the Certificate Snap-in.&lt;/P&gt;
&lt;P&gt;7) Create a BizTalk Solicit-Response Send port with a configured HTTP adapter for the MIB secure HTTP requests. The Send port is configured to use the installed certificate from step 6).&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/BizTalkMIBAcordSendPortjpg.jpg"&gt;&lt;/P&gt;
&lt;P&gt;8) Create BizTalk &lt;A href="http://www.microsoft.com/biztalk/evaluation/overview/screen_3.htm"&gt;&lt;STRONG&gt;map(s)&lt;/STRONG&gt;&lt;/A&gt; to transform the Acord XML response messages to internal messages.&lt;/P&gt;
&lt;P&gt;The above&amp;nbsp;pretty well covers all the required BizTalk objects.&lt;/P&gt;
&lt;P&gt;So why use BizTalk for the above MIB request/response loop or a similar business process:&lt;/P&gt;
&lt;P&gt;1) This is what BizTalk server does. It integrates a companies internal applications together and&amp;nbsp;also provides B2B capabilities.&lt;/P&gt;
&lt;P&gt;2) A number of turnkey solutions can be purchased that do the same communication loop with MIB. These turnkey solutions are probably more expensive and proprietary than a BizTalk Solution. There is little coding involved to build the above BizTalk solution and there is complete control over the process as a developer(s) is building it and maintaining it. For changes or modifications to the&amp;nbsp;BizTalk process, a configuration change is&amp;nbsp;sometimes all it takes.&lt;/P&gt;
&lt;P&gt;For BizTalk 2006 pricing go to &lt;A href="http://www.microsoft.com/biztalk/2006/howtobuy/pricing.mspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt; &lt;BR&gt;For BizTalk 2004 pricing got to &lt;A href="http://www.microsoft.com/biztalk/howtobuy/default.mspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I have heard claims that it took more than 1000 man hours to&amp;nbsp;complete the above process in BizTalk. This is completely untrue as it took me a fraction of 1000 hours to implement the above MIB communication loop using BizTalk.&lt;/P&gt;
&lt;P&gt;3) The BizTalk server that hosts the above process can be used to host other developed Application Integration or &lt;BR&gt;B2B business processes.&lt;/P&gt;
&lt;P&gt;4) BizTalk server is increasing exponentially&amp;nbsp;in popularity. More and more developers have BizTalk experience.&lt;/P&gt;
&lt;P&gt;5) BizTalk provides many useful out of the box features such as:&lt;/P&gt;
&lt;P&gt;a) Business Activity Monitoring&lt;BR&gt;b) Rules Engine&lt;BR&gt;c) Fault Tolerance/Load Balancing&lt;BR&gt;d) Tracking&lt;BR&gt;e) etc. etc. &lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Note: I do not mean to sugar coat the process. The BizTalk maps for the MIB requests and response messages are somewhat complex. The complexity of the maps can be attributed directly to the&amp;nbsp;large size&amp;nbsp;of the Acord XSD schemas. There are&amp;nbsp;larger XSD schemas. In my opinion, the HL7 XSD schemas are more complex then the Acord XSD schemas.&lt;BR&gt;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=3634" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>Processing a Large Flat File Message with BizTalk and the SqlBulkInsert Adapter</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2005/10/23/3525.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2005/10/23/3525.aspx</id><published>2005-10-23T21:14:00Z</published><updated>2005-10-23T21:14:00Z</updated><content type="html">&lt;P&gt;Below discusses the second demo for a presentation that I did at the Business Process Integration &amp;amp; Workflow Conference in Redmond during the week of Oct 4. &lt;/P&gt;
&lt;P&gt;The title of the presentation was entitled:&lt;BR&gt;&lt;STRONG&gt;Handling Large Messages in BizTalk&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The first demo that I did for the presentation can be found here:&lt;BR&gt;&lt;A href="http://objectsharp.com/blogs/matt/archive/2005/08/31/3209.aspx"&gt;&lt;STRONG&gt;Processing a large message and a faster, less CPU intensive splitter pattern.&lt;BR&gt;&lt;BR&gt;&lt;/STRONG&gt;&lt;/A&gt;This entry compares two different methods for processing large flat files in BizTalk.&lt;BR&gt;The size of the flat files being tested ranged in size from: 8MB to 201MB.&lt;/P&gt;
&lt;P&gt;At the end of this entry is the download for the SqlBulkInsert Adapter code and the BizTalk Test Project to&lt;BR&gt;perform the tests.&lt;/P&gt;
&lt;P&gt;A section of the flat file message being processed is as below. About half of the columns are cut off:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SqlBulkLoadAdapterSampleFF.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The above is the flat file representation of the XML Production orders message that were used in the first &lt;A href="http://objectsharp.com/blogs/matt/archive/2005/08/31/3209.aspx"&gt;&lt;STRONG&gt;Demo&lt;/STRONG&gt;&lt;/A&gt;.&lt;BR&gt;Each line of the flat file message contains a production order. The production order data (columns) are separated by commas and each production order line (record) is separated by a Carriage Return/Line Feed. &lt;/P&gt;
&lt;P&gt;To process the flat file message, two different implementations were used. In both implementations, the flat file is pre-processed so that it is in a format for further processing -&amp;gt; For example mapping or splitting.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;U&gt;Implementation One: Processing with a Flat File Schema and Custom Receive Pipeline&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;This implementation uses the standard method of using a XSD Schema with flat file extensions to represent the above flat file message. A custom receive pipeline utilizing a flat file disassembler transforms the flat file into an internal XML message. This XML message will be published into the MessageBox database. If you have not processed a flat file in BizTalk before, try this &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_sdk_samples_ckdg.asp"&gt;&lt;STRONG&gt;example&lt;/STRONG&gt; &lt;/A&gt;in the SDK.&lt;/P&gt;
&lt;P&gt;This is just a short recap of how this implementation works and is really for the benefit for those not familiar with BizTalk or who have never processed a flat file in BizTalk.&lt;/P&gt;
&lt;P&gt;a) Flat File is picked up by a Receive Location.&lt;BR&gt;b) Receive Location is configured to use a Custom Receive Pipeline&lt;BR&gt;c) Custom Receive Pipeline will convert (disassemble) the flat file, into an internal XML message as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SqlBulkLoadAdapterSampleXML.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;d) This XML Message is then published into the MessageBox database&lt;BR&gt;e) Once the XML Message is published into the MessageBox database, any number of Orchestrations or send Ports can subscribe to this message and process this message. This message could then be mapped into another message or split into separate messages as in the first demo.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;U&gt;Implementation Two: Processing with the SqlBulkInsert Adapter&lt;BR&gt;&lt;BR&gt;&lt;/U&gt;&lt;/STRONG&gt;From a performance perspective there are three areas where the above implementation can be improved. This is especially true, if the incoming flat files messages are large&amp;nbsp;greater than 20 MB.&lt;BR&gt;Areas of improvement are listed below:&lt;BR&gt;&lt;BR&gt;1) The pipeline processing time. &lt;BR&gt;2) CPU utilization is at 100% for pipeline processing.&lt;BR&gt;3) Flat files when converted into XML files can double or triple in size. For example when a 201MB flat file production order message is converted into an internal XML message, the size of this internal XML message expands to 767MB. This large 767MB message is then published into the MessageBox database. The size of the XML message is greater because of added tags, elements and attributes. &lt;/P&gt;
&lt;P&gt;Therefore one approach would be to skip the pipeline processing for the large flat file message. Pipeline processing is a necessary and great feature in BizTalk, but will be skipped in this implementation to increase performance.&lt;/P&gt;
&lt;P&gt;A Custom Adapter (SqlBulkInsert Adapter) will be used to pre-process the flat file.&lt;BR&gt;This adapter can only be used with a One-Way Receive Port. The property pages of the Receive Location are as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SqlBulkLoadAdapterReceiveLoc.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;How this implementation works:&lt;/P&gt;
&lt;P&gt;a) This adapter behaves similar to the out of the box File Adapter used in a Receive Location. It will poll a directory on a Hard Drive for files to be picked up and processed.&lt;BR&gt;&amp;nbsp;&lt;BR&gt;b) The &lt;STRONG&gt;FileReceiveFolder&lt;/STRONG&gt; Property is set to a directory on a hard drive. &lt;BR&gt;For example -&amp;gt; C:\BTSBulkLoad\Files\ReceiveForSqlBulkLoad &lt;BR&gt;Flat Files dropped into this folder will be picked up to be processed.&lt;/P&gt;
&lt;P&gt;c) The &lt;STRONG&gt;FileMask&lt;/STRONG&gt; Property is set so the adapter will only pick up only files with the mask. &lt;BR&gt;For example -&amp;gt; *.txt&lt;/P&gt;
&lt;P&gt;d) The &lt;STRONG&gt;FileErrorFolder&lt;/STRONG&gt; Property will be populated with error files. &lt;BR&gt;For example -&amp;gt; C:\BTSBulkLoad\Files\FileErrorFolder.&lt;BR&gt;If some of the rows(data) in the flat file message are malformed, these will not be processed , but will be placed in a file for viewing. This is analogous to a recoverable interchange. Rows in the flat file that are correct in structure will be processed. &lt;/P&gt;
&lt;P&gt;For example, if two of the rows in the flat file cannot be processed (Missing Columns, missing delimiters etc) a file is produced with the row(s) that could not be processed. &lt;/P&gt;
&lt;P&gt;11506,10020,TST GF 01 GRD 01,7045936818561,20.25,20.25,58.25,58.250359010995972,3 Inch Core,,,&lt;BR&gt;11665,10020,TST GF 01 GRD 01,36,23584,23584,1432.7045936818561,1432.7045936818561,20.25,20.25,5&lt;/P&gt;
&lt;P&gt;Additionally another file is produced with a more detailed explanation of why the row(s) could not be processed as below:&lt;/P&gt;
&lt;P&gt;Row 16 File Offset 3822 ErrorFile Offset 0 - HRESULT 0x80004005&lt;BR&gt;Row 25 File Offset 6422 ErrorFile Offset 493 - HRESULT 0x80004005&lt;/P&gt;
&lt;P&gt;The Max Number of rows with errors can be configured (explained below). If this number is exceeded, the operation will fail as a whole.&lt;/P&gt;
&lt;P&gt;Once a File has been picked up, the SqlBulkInsert adapter will use the below properties to delegate the processing of the flat file to a Sql server stored procedure. The large File will not be submitted to the BizTalk engine to be processed. Therefore the BizTalk pipeline processing will be skipped for the large file.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;e) The &lt;STRONG&gt;SqlConnectionString&lt;/STRONG&gt; Property is set with the connection string to the sql database that will process the flat file.&lt;BR&gt;For example -&amp;gt; packet size=4096;integrated security=SSPI;data source="(local)";persist security info=False;initial catalog=BTSSqlBulkLoad&amp;nbsp; &lt;/P&gt;
&lt;P&gt;f) The &lt;STRONG&gt;SqlStoredProcedureName&lt;/STRONG&gt; Property is set to the name of the stored procedure that will process the flat file.&lt;BR&gt;For example -&amp;gt; LoadInsertProductionOrders&lt;/P&gt;
&lt;P&gt;The declaration of the stored procedure is as below:&lt;/P&gt;
&lt;P&gt;CREATE Procedure [dbo].[LoadInsertProductionOrders]&lt;/P&gt;
&lt;P&gt;@pathAndFileName&amp;nbsp; varchar(500),&lt;BR&gt;@pathAndErrorFileName varchar(500)&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;g) The &lt;STRONG&gt;SqlStoredProcFileNameParameter&lt;/STRONG&gt; property will set with the name of&amp;nbsp; the parameter that accepts the file to be processed.&lt;BR&gt;For example -&amp;gt; @pathAndFileName&lt;/P&gt;
&lt;P&gt;At run time when the adapter picks up the file, it will generate the following to populate the&amp;nbsp;@pathAndFileName stored procedure parameter:&lt;BR&gt;For example -&amp;gt; C:\BTSBulkLoad\Files\ReceiveForSqlBulkLoad\FlatFileToProcess.txt &lt;/P&gt;
&lt;P&gt;Note: Only a pointer to the flat file to be processed is passed to the stored procedure.&lt;BR&gt;Note: UNC paths should also work, but have not actually tried. &lt;/P&gt;
&lt;P&gt;&lt;BR&gt;h) The &lt;STRONG&gt;SqlStoredProcFileErrorParameter&lt;/STRONG&gt; property is set to the name of the parameter in the stored procedure &lt;BR&gt;to indicate the location to where the error files should be placed. See part d)&lt;BR&gt;For example -&amp;gt; @pathAndErrorFileName&lt;/P&gt;
&lt;P&gt;At run time when the adapter picks up the file, it will set the&amp;nbsp;@pathAndErrorFileName stored procedure parameter to a Value.&lt;BR&gt;For example -&amp;gt; C:\BTSBulkLoad\Files\FileErrorFolder&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;At run time when the File Receive portion of the adapter has picked up a file to process, the following code is then called in the adapter to invoke the stored procedure:&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;internal static string callBulkInsertStoredProcedure&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;(string connectionString,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;int commandTimeOut,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;string storedProcedureName,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;string fileName,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;string fileErrorName,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;string fileNameParameterName,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;string fileErrorNameParameterName)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;System.Text.StringBuilder sbForReturnedXML = new System.Text.StringBuilder();&lt;BR&gt;&amp;nbsp;SqlConnection sqlConnect = new SqlConnection();&lt;BR&gt;&amp;nbsp;sqlConnect.ConnectionString = connectionString;&lt;BR&gt;&amp;nbsp;SqlCommand sqlCommand = new SqlCommand();&lt;BR&gt;&amp;nbsp;sqlCommand.CommandType = System.Data.CommandType.StoredProcedure;&lt;BR&gt;&amp;nbsp;sqlCommand.CommandText = storedProcedureName;&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;// Dynamically set the name of the parameters that should be called in the custom stored procedure.&lt;BR&gt;&amp;nbsp;// This is because each stored procedure may have parameters with different names.&lt;BR&gt;&amp;nbsp;sqlCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter(fileNameParameterName, System.Data.SqlDbType.VarChar,500));&lt;BR&gt;&amp;nbsp;sqlCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter(fileErrorNameParameterName, System.Data.SqlDbType.VarChar, 500));&lt;BR&gt;&amp;nbsp;sqlCommand.Parameters[fileNameParameterName].Value = fileName;&lt;BR&gt;&amp;nbsp;sqlCommand.Parameters[fileErrorNameParameterName].Value = fileErrorName;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;sqlCommand.Connection = sqlConnect;&lt;BR&gt;&amp;nbsp;sqlCommand.CommandTimeout = commandTimeOut;&lt;BR&gt;&amp;nbsp;System.Xml.XmlReader xmlReader = null;&lt;BR&gt;&amp;nbsp;sqlConnect.Open();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;try&lt;BR&gt;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;xmlReader = sqlCommand.ExecuteXmlReader();&lt;BR&gt;&amp;nbsp;&amp;nbsp;xmlReader.MoveToContent();&lt;BR&gt;&amp;nbsp;&amp;nbsp;string xmlProductionOrderIdNode;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;while (!xmlReader.EOF)&lt;BR&gt;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;xmlProductionOrderIdNode = xmlReader.ReadOuterXml();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;sbForReturnedXML = sbForReturnedXML.Append(xmlProductionOrderIdNode);&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;catch (System.Exception ex)&lt;BR&gt;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.Diagnostics.Debug.WriteLine("Error Occured in Adapter " + ex.Message);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw ex;&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;return sbForReturnedXML.ToString();&lt;BR&gt;&amp;nbsp;}&amp;nbsp;&lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;The above is just basic ADO.NET code to call the stored procedure that will return back a small &lt;BR&gt;XML message generated by the stored procedure. This XML message can contain any information. This small XML message will&lt;BR&gt;be published into the MessageBox database. (More about this below).&lt;/P&gt;
&lt;P&gt;The stored procedure configured in the receive location is executed. This is where the real processing of the flat file takes place.&lt;BR&gt;Note: This stored procedure could be altered in any way to process the flat file. The below is just an example.&lt;/P&gt;
&lt;P&gt;CREATE Procedure [dbo].[LoadInsertProductionOrders]&lt;/P&gt;
&lt;P&gt;@pathAndFileName&amp;nbsp; varchar(500),&lt;BR&gt;@pathAndErrorFileName varchar(500)&lt;/P&gt;
&lt;P&gt;-- This stored procedure will take the passed path of the flat file (produced by the the adapter) to process.&lt;BR&gt;-- For example c:\directory\FlatFile.txt. &lt;BR&gt;-- The code in this procedure will then &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ba-bz_4fec.asp"&gt;&lt;STRONG&gt;Bulk Insert&lt;/STRONG&gt; &lt;/A&gt;this flat file into a Sql Server table.&lt;BR&gt;-- This stored procedure was originally created in Sql 2000, but was moved to Sql 2005 &lt;BR&gt;-- for the following reasons:&lt;/P&gt;
&lt;P&gt;-- a) Sql 2005 has introduced a new argument for Bulk Insert Clause [ [ , ] ERRORFILE = 'file_name' ]&amp;nbsp; &lt;BR&gt;-- This will place malformed rows into an error file.&lt;/P&gt;
&lt;P&gt;-- b) Sql 2005 has introduced Try Catch Blocks in T-Sql. In Sql 2000, if there were any malformed &lt;BR&gt;-- rows in the flat file, an error would be raised to the .Net Helper Component and the operation would cease.&lt;BR&gt;-- With the Try Catch Block in Sql 2005, no error is raised to the .Net Helper Conponent and processing continues.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;As&lt;/P&gt;
&lt;P&gt;-- Flat File rows will be inserted into this temp table.&lt;BR&gt;-- Note: Could of used a &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/ad_impt_bcp_9yat.asp"&gt;&lt;STRONG&gt;Format File&lt;/STRONG&gt; &lt;/A&gt;&amp;nbsp;file, but this temp table matches the structure of the flat file.&lt;BR&gt;-- Eventually, the rows in this temp table will be inserted into a permanent table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CREATE TABLE #tempInsertNewProductionOrders (&lt;BR&gt;&amp;nbsp;[trk_unit_id] [int] NOT NULL ,&lt;BR&gt;&amp;nbsp;[pro_product_id] [int] NOT NULL ,&lt;BR&gt;&amp;nbsp;[actual_grade] [varchar] (80) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,&lt;BR&gt;&amp;nbsp;[actual_basis_weight] [float] NULL ,&lt;BR&gt;&amp;nbsp;[actual_length_at_turnup] [float] NULL ,&lt;BR&gt;&amp;nbsp;[actual_length] [float] NULL ,&lt;BR&gt;&amp;nbsp;[actual_weight_at_turnup] [float] NULL ,&lt;BR&gt;&amp;nbsp;[actual_weight] [float] NULL ,&lt;BR&gt;&amp;nbsp;[required_width] [float] NULL ,&lt;BR&gt;&amp;nbsp;[actual_width] [float] NULL ,&lt;BR&gt;&amp;nbsp;[required_diameter] [float] NULL ,&lt;BR&gt;&amp;nbsp;[actual_diameter] [float] NULL ,&lt;BR&gt;&amp;nbsp;[actual_core] [varchar] (80) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,&lt;BR&gt;&amp;nbsp;[actual_property_1] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,&lt;BR&gt;&amp;nbsp;[actual_property_2] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,&lt;BR&gt;&amp;nbsp;[actual_property_3] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,&lt;BR&gt;&amp;nbsp;[update_timechain] [smallint] NULL ,&lt;BR&gt;&amp;nbsp;[update_time] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,&lt;BR&gt;&amp;nbsp;[update_user_id] [int] NULL ,&lt;BR&gt;&amp;nbsp;[position_index] [int] NOT NULL ,&lt;BR&gt;&amp;nbsp;[comment] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,&lt;BR&gt;&amp;nbsp;[required_length] [float] NULL ,&lt;BR&gt;&amp;nbsp;[required_weight] [float] NULL ,&lt;BR&gt;&amp;nbsp;[actual_mfg_grade] [varchar] (80) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,&lt;BR&gt;&amp;nbsp;[actual_moisture] [float] NULL ,&lt;BR&gt;&amp;nbsp;[actual_caliper] [float] NULL ,&lt;BR&gt;&amp;nbsp;[actual_colour] [varchar] (80) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,&lt;BR&gt;&amp;nbsp;[actual_finish] [varchar] (80) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,&lt;BR&gt;&amp;nbsp;[set_number] [int] NULL ,&lt;BR&gt;&amp;nbsp;[position_percent] [int] NOT NULL ,&lt;BR&gt;&amp;nbsp;[tare_weight] [float] NULL ,&lt;BR&gt;&amp;nbsp;[user_scale_weight] [float] NULL ,&lt;BR&gt;&amp;nbsp;[wire_side] [char] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,&lt;BR&gt;&amp;nbsp;[trkc_length_adjust_type_id] [int] NULL ,&lt;BR&gt;&amp;nbsp;[actual_compression] [float] NULL ,&lt;BR&gt;&amp;nbsp;[actual_hardness] [float] NULL ,&lt;BR&gt;&amp;nbsp;[sch_prod_order_id] [int] NULL ,&lt;BR&gt;&amp;nbsp;[trk_set_item_id] [int] NULL ,&lt;BR&gt;&amp;nbsp;[trk_unit_id_package] [int] NULL )&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;declare @return int&lt;BR&gt;declare @rowcount int, @error int&lt;/P&gt;
&lt;P&gt;declare @sqlStatement varchar(8000)&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;-- Create the dynamic sql that contains the &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ba-bz_4fec.asp"&gt;&lt;STRONG&gt;Bulk Insert&lt;/STRONG&gt; &lt;/A&gt;Statement to Bulk Load the flat file into the Temp Table&lt;BR&gt;-- An Argument could of been used to control the max number of error rows. As below:&lt;BR&gt;-- MAXERRORS [ = max_errors ]&lt;BR&gt;-- MAXERRORS, Specifies the maximum number of errors that can occur before the bulk copy operation is canceled. &lt;BR&gt;-- Each row that cannot be imported by the bulk copy operation is ignored and counted as one error. If max_errors is not specified, the default is 10.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;set @sqlStatement = 'BULK INSERT #tempInsertNewProductionOrders' &lt;BR&gt;set @sqlStatement = @sqlStatement +&amp;nbsp;&amp;nbsp;&amp;nbsp; ' FROM ' +&amp;nbsp; ''''+ ltrim(rtrim(@pathAndFileName))&amp;nbsp; +'''' &lt;BR&gt;set @sqlStatement = @sqlStatement +&amp;nbsp; ' WITH '&lt;BR&gt;set @sqlStatement = @sqlStatement +&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&amp;nbsp; ( '&lt;BR&gt;set @sqlStatement = @sqlStatement +&amp;nbsp; ' FIELDTERMINATOR = '&amp;nbsp; +&amp;nbsp;&amp;nbsp; '''' + ',' + '''' + ','&lt;BR&gt;set @sqlStatement = @sqlStatement&amp;nbsp; + ' ROWTERMINATOR = ' +&amp;nbsp; ''''&amp;nbsp; +&amp;nbsp; '\n'&amp;nbsp;&amp;nbsp; + '''' + ','&lt;BR&gt;set @sqlStatement = @sqlStatement&amp;nbsp; + ' ERRORFILE = ' +&amp;nbsp; ''''&amp;nbsp; +&amp;nbsp; ltrim(rtrim(@pathAndErrorFileName ))&amp;nbsp;&amp;nbsp; + ''''&lt;BR&gt;set @sqlStatement = @sqlStatement&amp;nbsp; +&amp;nbsp;&amp;nbsp; ')' &lt;/P&gt;
&lt;P&gt;&lt;BR&gt;-- Temp Table for Sending back results&lt;/P&gt;
&lt;P&gt;create table #results (rowsprocessed int, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ErrorCode int, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BatchIdentifier varchar(50))&lt;/P&gt;
&lt;P&gt;-- Create a unique GUID, that will be stored in each row.&lt;BR&gt;-- This is to differentiate the rows from other batches.&lt;BR&gt;-- This GUID, will be returned back to the Adapter in a small XML message:&lt;/P&gt;
&lt;P&gt;declare @newid uniqueidentifier&lt;BR&gt;set @newid = newid()&lt;BR&gt;declare @UniqueIdentifier varchar(50)&lt;BR&gt;set @UniqueIdentifier = replace(convert(varchar(50), @newid),'-','')&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Begin Try &lt;BR&gt;&amp;nbsp;-- Excecute the Bulk Insert Statement&lt;BR&gt;&amp;nbsp;exec (@sqlStatement) &lt;/P&gt;
&lt;P&gt;&amp;nbsp;-- Insert the rows from the temp table into the Permanet Table.&lt;BR&gt;&amp;nbsp;-- For each row, also set the Batch Guid.&lt;BR&gt;&amp;nbsp;Insert into InsertNewProductionOrders&lt;BR&gt;&amp;nbsp;Select&amp;nbsp; #tempInsertNewProductionOrders.*,@UniqueIdentifier from #tempInsertNewProductionOrders&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Select @rowcount = @@rowcount,@error = @@error&amp;nbsp;&lt;BR&gt;&amp;nbsp;Insert into #results values(@rowcount,@error,@UniqueIdentifier)&lt;BR&gt;&amp;nbsp;&amp;nbsp; &lt;BR&gt;End Try &lt;BR&gt;Begin Catch&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Catch any errors and re-raise&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DECLARE @ErrorMessage NVARCHAR(400);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DECLARE @ErrorSeverity INT;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DECLARE @ErrorState INT;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT @ErrorMessage = ERROR_MESSAGE();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT @ErrorSeverity = ERROR_SEVERITY();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT @ErrorState = ERROR_STATE();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RAISERROR (@ErrorMessage, -- Message text.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @ErrorSeverity, -- Severity.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @ErrorState -- State.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; );&lt;BR&gt;End Catch;&lt;/P&gt;
&lt;P&gt;-- Send back a small informational XML message to the Adapter. &lt;BR&gt;-- This XML message will be published in the Messagebox Database:&lt;/P&gt;
&lt;P&gt;WITH XMLNAMESPACES ( DEFAULT 'http://SqlBulkInsert')&lt;BR&gt;Select rowsprocessed,&amp;nbsp; ErrorCode,BatchIdentifier,&lt;BR&gt;&amp;nbsp; (Select Distinct sch_prod_order_id&amp;nbsp; ProductionOrderId&lt;BR&gt;&amp;nbsp;&amp;nbsp; from #tempInsertNewProductionOrders&amp;nbsp; ProductionOrder&lt;BR&gt;&amp;nbsp;&amp;nbsp; For XML Auto ,Type ) &lt;BR&gt;from #results&amp;nbsp; Results&lt;BR&gt;For xml auto, ROOT('BulkInsertResults')&lt;/P&gt;
&lt;P&gt;-- Note with Sql 2005 can:&lt;BR&gt;-- a) Place a Root node around the returned XML&lt;BR&gt;-- b) Specify a Target Namespace.&lt;BR&gt;-- c) Do nesting with an XML Auto Statement.&lt;/P&gt;
&lt;P&gt;GO&lt;BR&gt;SET ANSI_NULLS OFF&lt;BR&gt;GO&lt;BR&gt;SET QUOTED_IDENTIFIER OFF&lt;/P&gt;
&lt;P&gt;A sample of the XML returned from this stored procedure is as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SqlBulkLoadAdapterSampleProcXML.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The above XML message is then passed back to the Adapter. This Small message is then published into the MessageBox Database.&lt;BR&gt;Note: When authoring this stored procedure, any information can be returned in this XML message.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Once this small XML message is published into the MessageBox database, any number of orchestrations can subscribe to this message. In this particular case, the main message (Now residing in a table in a Sql Server database) is to be split into separate messages by using the distinct production orders returned back in the above &lt;BR&gt;XML message. A discussion of this pattern can be found &lt;A href="http://objectsharp.com/blogs/matt/archive/2005/08/31/3209.aspx"&gt;&lt;STRONG&gt;here&lt;/STRONG&gt;&lt;/A&gt;. The productions order records in the Sql Server table could also be transformed (mapped) by using Select Statements with XML Auto and XML Explicit clauses.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Results of Tests&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The following hardware was used: Laptop with 2.0 GHz processor.&lt;BR&gt;Windows XP operating System hosting a Windows 2003 VPC image with 1.3 MB of memory allocated.&lt;BR&gt;This VPC image hosted the BizTalk 2006 Server and a Sql Server 2005 instance hosting the BizTalk databases.&lt;BR&gt;The local Sql Server instance also hosted the database where Bulk Insert operation occurred.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Test for processing one Message&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Only one flat file message was processed at a time. Only one implementation was tested at a time:&lt;BR&gt;Either the PipeLine (Implementation one) or the SqlBulkInsert Adapter (Impelementation Two).&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;U&gt;Results for Pipeline Processing&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;TABLE cellSpacing=1 cellPadding=1 width=560 border=1&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 109px" noWrap&gt;&lt;STRONG&gt;Size of Flat File&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD style="WIDTH: 151px" noWrap&gt;&lt;STRONG&gt;Time for Pipeline Processing&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD style="WIDTH: 131px"&gt;
&lt;P&gt;&lt;STRONG&gt;XML File Size (Published into the MessageBox)&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;STRONG&gt;Number of Rows (Production Orders) &amp;nbsp;in Message&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 109px"&gt;201 MB&lt;/TD&gt;
&lt;TD style="WIDTH: 151px"&gt;25 Minutes&lt;/TD&gt;
&lt;TD style="WIDTH: 131px"&gt;767 MB&lt;/TD&gt;
&lt;TD&gt;807428&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 109px"&gt;108 MB&lt;/TD&gt;
&lt;TD style="WIDTH: 151px"&gt;13&amp;nbsp;Minutes&lt;/TD&gt;
&lt;TD style="WIDTH: 131px"&gt;413 MB&lt;/TD&gt;
&lt;TD&gt;435076&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 109px"&gt;56 MB&lt;/TD&gt;
&lt;TD style="WIDTH: 151px"&gt;7&amp;nbsp;Minutes&lt;/TD&gt;
&lt;TD style="WIDTH: 131px"&gt;213 MB&lt;/TD&gt;
&lt;TD&gt;224130&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 109px"&gt;30 MB&lt;/TD&gt;
&lt;TD style="WIDTH: 151px"&gt;4 Minutes&lt;/TD&gt;
&lt;TD style="WIDTH: 131px"&gt;114 MB&lt;/TD&gt;
&lt;TD&gt;120234&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 109px"&gt;15 MB&lt;/TD&gt;
&lt;TD style="WIDTH: 151px"&gt;3 Minutes&lt;/TD&gt;
&lt;TD style="WIDTH: 131px"&gt;56 MB&lt;/TD&gt;
&lt;TD&gt;62234&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 109px"&gt;8 MB&lt;/TD&gt;
&lt;TD style="WIDTH: 151px"&gt;2 Minutes&lt;/TD&gt;
&lt;TD style="WIDTH: 131px"&gt;31 MB&lt;/TD&gt;
&lt;TD&gt;29123&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;U&gt;Results for SqlBulkInsert Adapter&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;TABLE cellSpacing=1 cellPadding=1 width=560 border=1&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 138px; HEIGHT: 40px"&gt;&lt;STRONG&gt;Size of Flat File&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD style="WIDTH: 227px; HEIGHT: 40px"&gt;&lt;STRONG&gt;Time For&amp;nbsp;SqlBulkInsert&amp;nbsp;Adapter Load&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD style="HEIGHT: 40px"&gt;&lt;STRONG&gt;Number of Rows (Production Orders) &amp;nbsp;in Message&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 138px"&gt;201 MB&lt;/TD&gt;
&lt;TD style="WIDTH: 227px"&gt;3 Minutes&lt;/TD&gt;
&lt;TD&gt;807428&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 138px"&gt;108 MB&lt;/TD&gt;
&lt;TD style="WIDTH: 227px"&gt;1 Minute 15 Seconds&lt;/TD&gt;
&lt;TD&gt;435076&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 138px"&gt;56 MB&lt;/TD&gt;
&lt;TD style="WIDTH: 227px"&gt;50 Seconds&lt;/TD&gt;
&lt;TD&gt;224130&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 138px"&gt;30 MB&lt;/TD&gt;
&lt;TD style="WIDTH: 227px"&gt;15 Seconds&lt;/TD&gt;
&lt;TD&gt;120234&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 138px"&gt;15 MB&lt;/TD&gt;
&lt;TD style="WIDTH: 227px"&gt;8&amp;nbsp;Seconds&lt;/TD&gt;
&lt;TD&gt;62234&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="WIDTH: 138px"&gt;8 MB&lt;/TD&gt;
&lt;TD style="WIDTH: 227px"&gt;5 Seconds&lt;/TD&gt;
&lt;TD&gt;29123&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;U&gt;Discussion of Results&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Implementation One: Processing with a Flat File Schema and Custom Receive Pipeline&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;This is the usual method to process a flat file in BizTalk. Besides disassembling (converting) the flat file into an XML format, receive pipelines perform many other important operations such as:&lt;BR&gt;a) Decoding&lt;BR&gt;b) Disassembling&lt;BR&gt;c) Validation&lt;BR&gt;d) Custom operations using Custom pipeline Components. One example would be Unzipping a file.&lt;BR&gt;etc.&lt;BR&gt;&lt;BR&gt;&lt;U&gt;The Good&lt;BR&gt;&lt;/U&gt;&lt;BR&gt;a) It works!&lt;BR&gt;b) From a design point of view, this is the preferred method as the pipeline can perform a number &lt;BR&gt;of operations on the original message before the final message is published into the messagebox database.&lt;BR&gt;c) Much more complicated flat files can be disassembled in a pipeline. The flat file used in the demo, is simple in structure.&lt;BR&gt;An example of a more complicated delimited and positional flat file is as below, with Header, Detail and Footer Records:&lt;/P&gt;
&lt;P&gt;PO1999-10-20&lt;BR&gt;US&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Alice Smith&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 123 Maple Street&amp;nbsp;&amp;nbsp;&amp;nbsp; Mill Valley&amp;nbsp;&amp;nbsp;&amp;nbsp; CA 90952&lt;BR&gt;US&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Robert Smith&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8 Oak Avenue&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Old Town&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PA 95819&lt;BR&gt;Hurry, my lawn is going wild!&lt;BR&gt;ITEMS,ITEM872-AA|Lawnmower|1|148.95&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;U&gt;The Bad&lt;BR&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;For large Flat File Messages:&lt;BR&gt;a) the operation is somewhat slow (see times above), &lt;BR&gt;b) CPU is pinned the entire time the flat file is being processed in the pipeline.&lt;BR&gt;c) The original flat file message when converted to a XML, more than triples in Size, for example:&lt;BR&gt;201 MB (flat file) transforms to 767 MB (XML). Depending on the operation being performed, a 767 MB message may be unmanageable (for example as a source message in a map).&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;U&gt;Implementation Two : Processing with the SqlBulkInsert Adapter&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;This implementation was discussed in detail above.&lt;BR&gt;&lt;BR&gt;&lt;U&gt;The Good&lt;BR&gt;&lt;/U&gt;&lt;U&gt;&lt;BR&gt;&lt;/U&gt;a) Much faster in pre-processing the large messages (see times above).&lt;BR&gt;b) Will not pin the CPU on the BizTalk machine (pipeline processing is skipped)&lt;BR&gt;c) Large XML messages are not published into the messagebox database.&lt;BR&gt;d) There really is not much to this -&amp;gt; A custom adapter and a stored procedure.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;U&gt;The Bad&lt;BR&gt;&lt;BR&gt;&lt;/U&gt;a) A more complex flat file (see complex flat file message above) cannot be processed with this implementation. This is a limitation of the Bulk Insert Statement.&lt;BR&gt;Other techniques could be investigated to Load structurally more complex flat files into Sql Server including: &lt;BR&gt;i) DTS (Data Transformation Services). Sql 2000 and Sql 2005&lt;BR&gt;ii) Sql Server Integration Services. Sql 2005&lt;BR&gt;b) For the initial message the receive pipeline processing is skipped. If the incoming flat file was encoded or zipped up then the incoming flat file could be first be processed by another receive location/pipeline to decode or unzip, and then routed to a folder where the receive location is configured to use the SqlBulkInsert adapter.&lt;BR&gt;c) The process (orchestration) that subscribes to the small XML message published into the MessageBox, has to be configured to connect to the&amp;nbsp;database where the main message is stored in a relational sql table. This might mean just configuring&amp;nbsp;Solicit - Send Send ports using a Sql Adapter&lt;BR&gt;d) If using a Bulk Insert Statement to load in the flat file, Sql 2005 might have to be used. (See comments in the Stored Procedure)&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;U&gt;Final Thoughts&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I have only spent about two hours on the adapter and it is not ready for production (It is a prototype).&lt;BR&gt;I have also tested by processing two large messages simultaneously. Therefore if you are interested in&amp;nbsp; &lt;BR&gt;using it, download the code and modify or just start from scratch. The code in the adapter is relatively straightforward. &lt;/P&gt;
&lt;P&gt;The adapter was originally created with the &lt;A href="http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=d3ac121c-8963-4735-b5e1-fc83b02f57c1"&gt;&lt;STRONG&gt;BizTalk Server 2004 Adapter Wizard&lt;/STRONG&gt; &lt;/A&gt;and uses the common adapter base classes and interfaces.&lt;/P&gt;
&lt;P&gt;This technique (Adapter) could also be used to &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sqlxml3/htm/bulkload_7pv0.asp"&gt;&lt;STRONG&gt;Bulk load an XML&lt;/STRONG&gt; &lt;/A&gt;message into Sql Server.&lt;BR&gt;Download the Code &lt;A href="http://www.objectsharp.com/blogs/matt/images/BTSBulkLoad.zip"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;. Read the &lt;A href="http://www.objectsharp.com/blogs/matt/images/BTSBulkLoadReadme.txt"&gt;&lt;FONT color=#800080&gt;&lt;STRONG&gt;ReadMe.Txt&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color=#174267&gt; &lt;/FONT&gt;&lt;/A&gt;before installing and running.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=3525" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>Will Windows Workflow Foundation Replace BizTalk Server ?</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2005/09/21/3459.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2005/09/21/3459.aspx</id><published>2005-09-21T15:57:00Z</published><updated>2005-09-21T15:57:00Z</updated><content type="html">&lt;P&gt;The answer is no. Here is an excerpt from David Chappell's excellent whitepaper: &lt;A href="http://msdn.microsoft.com/windowsvista/building/workflow/default.aspx?pull=/library/en-us/dnlong/html/WWFIntro.asp"&gt;Introducing Microsoft Windows Workflow Foundation: An Early Look&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Use Windows Workflow Foundation when:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;An application will itself host workflows. Windows Workflow Foundation lets workflow be built into an application, allowing the workflow to be deployed and managed as a native part of the application. Because it's focused on integrating diverse applications rather than providing a general workflow framework, BizTalk Server always runs orchestrations within the BizTalk Server process. &lt;/P&gt;
&lt;P&gt;The business process being implemented requires human workflow. BizTalk Server addresses system workflow, and so it lacks Windows Workflow Foundation's support for things such as state machine workflows and dynamic update. A scenario that requires both human workflow and more complex system integration services could be addressed by using Windows Workflow Foundation and BizTalk Server together, however. For example, the Office "12" support for document-centric workflows, based on Windows SharePoint Services, might be used for the human aspects of the problem, while BizTalk Server handles the system integration aspects. The two can interoperate using the BizTalk Server Adapter for SharePoint. &lt;BR&gt;The workflow will execute on a client system. BizTalk Server is a server-focused product, and so it's less well-suited to run on desktop machines. &lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;Use BizTalk Server when: &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Solving an EAI problem that requires communication with diverse applications on diverse platforms. Because of its focus on cross-platform integration, a large set of adapters is available for BizTalk Server that allows communication with a range of other software. Windows Workflow Foundation is focused solely on workflow, not EAI, and so it doesn't provide these things. &lt;BR&gt;B2B services are required. Windows Workflow Foundation doesn't address this area, while BizTalk Server provides tools for working with trading partners, accelerators for RosettaNet, SWIFT, and other industry standards, and more. &lt;BR&gt;BPM services, such as Business Activity Monitoring (BAM), are required. While the Windows Workflow Foundation tracking infrastructure can be used to create these services, BizTalk Server provides important extras, such as tools that let information workers define their own BAM views. &lt;BR&gt;A complete management infrastructure and support for increased scalability are required. Unlike Windows Workflow Foundation, BizTalk Server includes a full set of tools for administering and scaling a production environment. &lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt; &lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=3459" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>BizTalk 2004 and 2006 -&gt; Processing a large message and a faster, less CPU intensive splitter pattern.</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2005/08/31/3209.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2005/08/31/3209.aspx</id><published>2005-09-01T00:54:00Z</published><updated>2005-09-01T00:54:00Z</updated><content type="html">&lt;P&gt;The following is a comparison of splitter orchestration patterns using BizTalk 2004 SP1 and BizTalk 2006 Beta 1. You can download the samples discussed below at the end of this blog entry and install and test on a BizTalk 2004 installation and/or BizTalk 2006 installation. Included in the download is a large test message (approximate size of 133 MB).&lt;/P&gt;
&lt;P&gt;Some details of the tests are as below:&lt;/P&gt;
&lt;P&gt;1) All orchestration implementations split or debatch the same message. &lt;BR&gt;2) The xml message to split is approximately 133 MB in size (on disk)&lt;BR&gt;3) There are a total of 80570 production orders in the message.&lt;BR&gt;4) An abbreviated message with just one complete production order looks like the below.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SplitterCompareTestMessage.jpg"&gt;&lt;/P&gt;
&lt;P&gt;5) Each production order in the message contains a production order id. For example: sch_prod_order_id = 10031&lt;BR&gt;6) There are 51 distinct production order ids in the message.&lt;BR&gt;7) In each splitter pattern implementation, 51 messages are split out from the main message, as defined by the 51 distinct production order ids. Each split message contains all the productions orders with one distinct production order id.&lt;BR&gt;8) The size of the split messages range in size from 111KB to 23MB.&lt;BR&gt;9) Four Different Orchestration Splitter pattern implementations were tested. The patterns were tested on a BizTalk 2004 SP1 installation with 1GB of memory and a BizTalk 2006 Beta 1 installation. All BizTalk databases (i.e. MessageBox etc.) ran on the same physical machine as the BizTalk servers. My BizTalk 2006 Beta 1 installation was installed on a VPC image. The image had only 700 MB of memory assigned to it, and needed more memory for a fair comparison with the BizTalk 2004 SP1 installation. Therefore the results for the BizTalk 2006 installation are incomplete.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Implementation One : Orchestration Splitting with a Map &lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The details on this splitter pattern can be found &lt;A href="http://objectsharp.com/blogs/matt/archive/2005/04/12/1703.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;. To quickly recap, a large production order message is processed by an orchestration and first run through a map utilizing custom XSLT to produce an xml message with the distinct production order ids as below: &lt;/P&gt;
&lt;P&gt;&lt;?xml:namespace prefix = ns0 /&gt;&lt;ns0:DistinctProductionOrders xmlns:ns0="http://SqlSplitterHelper"&gt;&lt;ns0:DistinctProductionOrders xmlns:ns0="http://SqlSplitterHelper"&gt;&lt;ns0:DistinctProductionOrders xmlns:ns0="http://SqlSplitterHelper"&gt;&lt;ns0:DistinctProductionOrders xmlns:ns0="http://SqlSplitterHelper"&gt;&lt;ns0:DistinctProductionOrders xmlns:ns0="http://SqlSplitterHelper"&gt;&lt;ns0:DistinctProductionOrders xmlns:ns0="http://SqlSplitterHelper"&gt;&lt;ns0:DistinctProductionOrders xmlns:ns0="http://SqlSplitterHelper"&gt;&lt;ns0:DistinctProductionOrders xmlns:ns0="http://SqlSplitterHelper"&gt;&amp;lt;ns0:DistinctProductionOrders xmlns:ns0="&lt;A href="http://SqlSplitterHelper"&gt;http://SqlSplitterHelper&lt;/A&gt;"&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;ProductionOrder ProductionOrderId="10001" /&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;ProductionOrder ProductionOrderId="10003" /&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;ProductionOrder ProductionOrderId="10002" /&amp;gt; &lt;BR&gt;&amp;lt;/ns0:DistinctProductionOrders&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;PRODUCTIONORDER ProductionOrderId="10001" /&gt;&lt;BR&gt;&lt;PRODUCTIONORDER ProductionOrderId="10003" /&gt;&lt;/ns0:DistinctProductionOrders&gt;&lt;/ns0:DistinctProductionOrders&gt;&lt;/ns0:DistinctProductionOrders&gt;&lt;/ns0:DistinctProductionOrders&gt;&lt;/ns0:DistinctProductionOrders&gt;&lt;/ns0:DistinctProductionOrders&gt;&lt;/ns0:DistinctProductionOrders&gt;&lt;/ns0:DistinctProductionOrders&gt;Each iteration of a loop in the orchestration is used to read a distinct production order id. Additionally, in each iteration of the loop, a map is used&amp;nbsp; to filter out a split message containing productions orders with that iterations distinct production order id.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Implementation Two : Orchestration Splitting using a SQL Server database&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;One of the problems faced with Splitting the large messsage using a map, is the CPU utilization of the BizTalk server. During the life of a splitter map orchestration instance, the CPU is maxed out at 100% (Note: This was true with the BizTalk 2004 installation but did not seem to be with the BizTalk 2006 installation). If there is only one BizTalk Server in the group, this limits the number of orchestration instances that can be running simultaneously. Therefore why not use something else to split the message and not rely on CPU resource intensive XSLT? One approach is to use a SQL server database to help split the large message. Querying 80000 or more rows is fast and efficient in Sql server and each message can easily be split using a Select Statement (with a For XML Auto or XML Explicit clause). One of the problems is how to get the 133 MB message from a BizTalk Orchestration into a Sql Server database efficiently (explained below). Below are the steps done in the orchestration to get this pattern to work:&lt;/P&gt;
&lt;P&gt;1) The large production message comes into the Sql splitter orchestration. &lt;BR&gt;2) The large message is assigned to a variable of type : System.XML.XMLDocument&lt;/P&gt;
&lt;P&gt;varXMLDomMessageToProcess = msgProductionOrdersToSplit;&lt;BR&gt;&amp;nbsp;&lt;BR&gt;3) A .Net helper component was called from the orchestration passing as one of the parameters the OuterXML of System.Xml.XmlDocument variable as below:&lt;/P&gt;
&lt;P&gt;varstrReturnedXML =&amp;nbsp; varObjSqlHelper.GetDistinctProductionOrders(varXMLDomMessageToProcess.OuterXml,varStrSqlConnectString,varGuidOrchestrationInstanceID);&lt;/P&gt;
&lt;P&gt;Note: Ultimately a stored procedure is called by the .Net helper code to process the large production order message. A .NET helper component (called within an Atomic Scope shape) is used to call the stored procedure in place of Send/Receive shapes and a Send port using a Sql Adapter for the following reasons:&lt;BR&gt;a) To cut down on the number of items that have to be persisted.&lt;BR&gt;b) Passing the large string of XML to the stored procedure via a Send Port and Sql Adapter did not seem to work with the large message (Note: I did&amp;nbsp; &lt;BR&gt;not try this with BizTalk 2006 only BizTalk 2004).&lt;/P&gt;
&lt;P&gt;4) The .Net Helper method, receives the string of XML (Note: This is the entire 133 MB message) and calls a stored procedure passing as one of the parameters the string of XML (Note: The stored procedure is called only once with the entire 133MB message). The Stored procedure then inserts all the&amp;nbsp;production orders into a Sql Server relational table. It also returns back a string of XML with a list of distinct production order ids. The code for the .Net helper component that is called from the orchestration is as below: &lt;/P&gt;
&lt;P&gt;public string GetDistinctProductionOrders(string xmlProductionOrderMessage,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string connectionString,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.Guid orchestrationIdentifier)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;string distinctOrdersXML;&lt;BR&gt;&amp;nbsp;// Set up SqlConnection,SqlCommand and Parameters to call Stored procedure -&amp;gt; InsertProductionOrders&lt;BR&gt;&amp;nbsp;SqlConnection sqlConnect = new SqlConnection();&lt;BR&gt;&amp;nbsp;sqlConnect.ConnectionString = connectionString;&lt;BR&gt;&amp;nbsp;SqlCommand sqlCommand = new SqlCommand();&lt;BR&gt;&amp;nbsp;sqlCommand.CommandType = System.Data.CommandType.StoredProcedure;&lt;BR&gt;&amp;nbsp;// Below is name of the Stored Procedure that will be called&lt;BR&gt;&amp;nbsp;sqlCommand.CommandText = "[InsertProductionOrders]";&lt;BR&gt;&amp;nbsp;// Add the Parameters needed to call the stored procedure&lt;BR&gt;&amp;nbsp;sqlCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@xmlString", System.Data.SqlDbType.Text));&lt;BR&gt;&amp;nbsp;sqlCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@orchestrationIdentifier", System.Data.SqlDbType.UniqueIdentifier));&lt;BR&gt;&amp;nbsp;// Set the XML passed to the method to the @xmlString Parameter that will be receive by the stored proc.&lt;BR&gt;&amp;nbsp;sqlCommand.Parameters["@xmlString"].Value = xmlProductionOrderMessage;&lt;BR&gt;&amp;nbsp;// Set the UniqueIdentifier (Guid) so calls to splitter proc will get correct records for that orchestration instance&lt;BR&gt;&amp;nbsp;sqlCommand.Parameters["@orchestrationIdentifier"].Value = orchestrationIdentifier;&lt;BR&gt;&amp;nbsp;sqlCommand.Connection = sqlConnect;&lt;BR&gt;&amp;nbsp;// This will take a few minutes, so set to 0 to wait indefinitely&lt;BR&gt;&amp;nbsp;sqlCommand.CommandTimeout = 0;&lt;BR&gt;&amp;nbsp;// open connection to DB&lt;BR&gt;&amp;nbsp;sqlConnect.Open();&lt;BR&gt;&amp;nbsp;// Use an XmlReader to get back the Distinct XML of ProductionOrdersIds from the Stored Procedure&lt;BR&gt;&amp;nbsp;System.Xml.XmlReader xmlReader = sqlCommand.ExecuteXmlReader();&lt;BR&gt;&amp;nbsp;// Now use the XmlReader to get the XML returned by the stored procedure&lt;BR&gt;&amp;nbsp;xmlReader.MoveToContent();&lt;BR&gt;&amp;nbsp;string xmlProductionOrderIdNode;&amp;nbsp;&lt;BR&gt;&amp;nbsp;System.Text.StringBuilder sbForReturnedXML = new System.Text.StringBuilder();&lt;BR&gt;&amp;nbsp;while (!xmlReader.EOF)&lt;BR&gt;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp; xmlProductionOrderIdNode = xmlReader.ReadOuterXml();&lt;BR&gt;&amp;nbsp;&amp;nbsp; sbForReturnedXML = sbForReturnedXML.Append(xmlProductionOrderIdNode); &lt;BR&gt;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;// Get all the XML from the String Builder&lt;BR&gt;&amp;nbsp;distinctOrdersXML = sbForReturnedXML.ToString();&lt;BR&gt;&amp;nbsp;xmlReader.Close();&amp;nbsp;&lt;BR&gt;&amp;nbsp;sqlConnect.Close();&lt;BR&gt;&amp;nbsp;// Return the Distinct list of Production orders in XML Format&lt;BR&gt;&amp;nbsp;// Note: The calling orchestration will add the Root node and targetnamespace to this xml document. &lt;BR&gt;&amp;nbsp;return distinctOrdersXML;&lt;BR&gt;}&amp;nbsp;&lt;/P&gt;
&lt;P&gt;5) The .NET helper component from above passes the large message down to a Sql Server Stored procedure (all 133MB in one call to the stored procedure). &lt;BR&gt;A Sql Server 2000 database was created with one table and two stored procedures to perform the initial insert of the XML into a relational table and to&amp;nbsp; &lt;BR&gt;split out the messages. The objects inside of the database are:&lt;/P&gt;
&lt;P&gt;Table -&amp;gt; InsertNewProductionOrders. To hold the contents of the production order XML in a relational table.&lt;BR&gt;Stored Procedure -&amp;gt; InsertProductionOrders. Uses an OpenXML statement to take the XML and insert into the InsertNewProductionOrders table.&lt;BR&gt;Stored Procedure -&amp;gt; GetSplitProductionOrderMessage. Is called to split out each individual message.&lt;/P&gt;
&lt;P&gt;The Stored procedure (InsertProductionOrders) inserts the XML message into relational table (InsertNewProductionOrders) using an OpenXML statement. It&amp;nbsp; &lt;BR&gt;then executes a select statement (with a For XML clause) to return the list of distinct orders in the table. Other benefits of using OpenXML with BizTalk can be found &lt;A href="http://www.m3technologypartners.com/Blogs/PermaLink.aspx?guid=0317986f-41ab-4bff-b872-d79cba73dcc2"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt; and &lt;STRONG&gt;&lt;A href="http://www.m3technologypartners.com/Blogs/PermaLink.aspx?guid=a6928de2-bb99-4b2b-809c-f69dff6182e9"&gt;HERE&lt;/A&gt;&lt;/STRONG&gt;.&lt;BR&gt;&lt;BR&gt;Stored procedure -&amp;gt; InsertProductionOrders is as below:&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Create Procedure InsertProductionOrders&lt;/P&gt;
&lt;P&gt;-- Will take string of passed XML and insert into a table&lt;/P&gt;
&lt;P&gt;@xmlString Text, -- This is the String of XML for all the production orders&lt;BR&gt;@orchestrationIdentifier uniqueidentifier&amp;nbsp; -- Identifier for matching records to correct orchestration&amp;nbsp; &lt;BR&gt;instance&lt;/P&gt;
&lt;P&gt;as &lt;/P&gt;
&lt;P&gt;DECLARE @iDocProdOrders int&lt;/P&gt;
&lt;P&gt;-- Use OpenXML to insert the orders into the table&lt;/P&gt;
&lt;P&gt;EXEC sp_XML_PrepareDocument @iDocProdOrders OUTPUT, @xmlString, '&lt;PRODUCTIONORDERS &lt;BR&gt;xmlns:ns0="'"&amp;gt;http://SqlSplitterHelper"/&amp;gt;'&lt;BR&gt;if @@error &amp;lt;&amp;gt; 0 goto err_handler&lt;/P&gt;
&lt;P&gt;Insert Into InsertNewProductionOrders&lt;BR&gt;Select *, @orchestrationIdentifier&amp;nbsp;&lt;BR&gt;From OpenXML (@iDocProdOrders,'//ns0:ProductionOrder',1)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; With (trk_unit_id int '@trk_unit_id',&lt;BR&gt;&amp;nbsp;pro_product_id int '@pro_product_id',&lt;BR&gt;&amp;nbsp;actual_grade varchar (80) '@actual_grade',&lt;BR&gt;&amp;nbsp;actual_basis_weight float '@actual_basis_weight',&lt;BR&gt;&amp;nbsp;actual_length_at_turnup float '@actual_length_at_turnup',&lt;BR&gt;&amp;nbsp;actual_length float '@actual_length',&lt;BR&gt;&amp;nbsp;actual_weight_at_turnup float '@actual_weight_at_turnup',&lt;BR&gt;&amp;nbsp;actual_weight float&amp;nbsp; '@actual_weight',&lt;BR&gt;&amp;nbsp;required_width float&amp;nbsp; '@required_width',&lt;BR&gt;&amp;nbsp;actual_width float&amp;nbsp; '@actual_width',&lt;BR&gt;&amp;nbsp;required_diameter float '@required_diameter',&lt;BR&gt;&amp;nbsp;actual_diameter float&amp;nbsp; '@actual_diameter',&lt;BR&gt;&amp;nbsp;actual_core varchar (80) '@actual_core',&lt;BR&gt;&amp;nbsp;actual_property_1 varchar (255) '@actual_property_1',&lt;BR&gt;&amp;nbsp;actual_property_2 varchar (255) '@actual_property_2',&lt;BR&gt;&amp;nbsp;actual_property_3 varchar (255) '@actual_property_3',&lt;BR&gt;&amp;nbsp;update_timechain smallint '@update_timechain',&lt;BR&gt;&amp;nbsp;update_time datetime '@update_time',&lt;BR&gt;&amp;nbsp;update_user_id int&amp;nbsp; '@update_user_id',&lt;BR&gt;&amp;nbsp;position_index int&amp;nbsp; '@position_index',&lt;BR&gt;&amp;nbsp;comment varchar (255) '@comment',&lt;BR&gt;&amp;nbsp;required_length float '@required_length',&lt;BR&gt;&amp;nbsp;required_weight float '@required_weight',&lt;BR&gt;&amp;nbsp;actual_mfg_grade varchar '@actual_mfg_grade',&lt;BR&gt;&amp;nbsp;actual_moisture float '@actual_moisture',&lt;BR&gt;&amp;nbsp;actual_caliper float '@actual_caliper',&lt;BR&gt;&amp;nbsp;actual_colour varchar '@actual_colour',&lt;BR&gt;&amp;nbsp;actual_finish varchar '@actual_finish',&lt;BR&gt;&amp;nbsp;set_number int&amp;nbsp; '@set_number',&lt;BR&gt;&amp;nbsp;position_percent int '@position_percent',&lt;BR&gt;&amp;nbsp;tare_weight float&amp;nbsp; '@tare_weight',&lt;BR&gt;&amp;nbsp;user_scale_weight float '@user_scale_weight',&lt;BR&gt;&amp;nbsp;wire_side char (3) '@wire_side',&lt;BR&gt;&amp;nbsp;trkc_length_adjust_type_id int '@trkc_length_adjust_type_id',&lt;BR&gt;&amp;nbsp;actual_compression float&amp;nbsp; '@actual_compression',&lt;BR&gt;&amp;nbsp;actual_hardness float&amp;nbsp; '@actual_hardness',&lt;BR&gt;&amp;nbsp;sch_prod_order_id int&amp;nbsp; '@sch_prod_order_id',&lt;BR&gt;&amp;nbsp;trk_set_item_id int '@trk_set_item_id',&lt;BR&gt;&amp;nbsp;trk_unit_id_package int '@trk_unit_id_package')&amp;nbsp;&amp;nbsp;&lt;BR&gt;if @@error &amp;lt;&amp;gt; 0 goto err_handler&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EXEC sp_XML_RemoveDocument @iDocProdOrders&lt;BR&gt;if @@error &amp;lt;&amp;gt; 0 goto err_handler&lt;/P&gt;
&lt;P&gt;-- Now return back the list of Distinct Production Orders from the &lt;BR&gt;-- table. The orchestration instance id is used to return back the correct Production orders&lt;BR&gt;-- if two or more orchestration instances are running simultaneously.&lt;/P&gt;
&lt;P&gt;Select distinct sch_prod_order_id as 'ProductionOrderId'&lt;BR&gt;From&amp;nbsp; InsertNewProductionOrders as ProductionOrder&lt;BR&gt;Where&amp;nbsp; OrchestrationIdentifier = @orchestrationIdentifier&lt;BR&gt;For XML Auto&lt;/P&gt;
&lt;P&gt;Return 0&lt;/P&gt;
&lt;P&gt;err_handler:&lt;/P&gt;
&lt;P&gt;Return -1&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;6) As with the map splitter orchestration, each iteration of a loop shape processes a distinct ProductionOrderId. (Note: the list of distinct ProductionOrderId's was returned by the InsertProductionOrders stored procedure discussed above). In each iteration of the loop, stored procedure GetSplitProductionOrderMessage is called to retrieve a split message containing productions orders with one distinct production order id. A Send and&amp;nbsp; Receive Shape are used in the orchestration that use a Static Solicit - Response Send port to call stored procedure GetSplitProductionOrderMessage,passing it the following parameters:&lt;/P&gt;
&lt;P&gt;@ProductionOrderID int,&amp;nbsp; -- To filter out the production orders for that message.&lt;BR&gt;@orchestrationIdentifier uniqueidentifier, -- GUID of orchestration instance.&lt;BR&gt;@deleteIndicator&amp;nbsp; int = 0 -- To indicate whether to delete this orchestrations instances records, &lt;BR&gt;-- so as not to bloat table InsertNewProductionOrders with unecesarry records.&lt;/P&gt;
&lt;P&gt;Stored procedure GetSplitProductionOrderMessage, then uses a For XML Auto clause to return back the split message as below:&lt;BR&gt;&amp;nbsp;&lt;BR&gt;Create Procedure GetSplitProductionOrderMessage&lt;/P&gt;
&lt;P&gt;@ProductionOrderID int,&lt;BR&gt;@orchestrationIdentifier uniqueidentifier,&lt;BR&gt;@deleteIndicator&amp;nbsp; int = 0&lt;/P&gt;
&lt;P&gt;as &lt;/P&gt;
&lt;P&gt;Select *&lt;BR&gt;From&amp;nbsp; InsertNewProductionOrders As&amp;nbsp; ProductionOrder (nolock)&lt;BR&gt;Where sch_prod_order_id = @ProductionOrderID&lt;BR&gt;and OrchestrationIdentifier = @orchestrationIdentifier &lt;BR&gt;For XML Auto -- , XMLData&lt;BR&gt;if @@error &amp;lt;&amp;gt; 0 goto err_handler&lt;/P&gt;
&lt;P&gt;if @deleteIndicator = 1&lt;BR&gt;Begin&lt;BR&gt;&amp;nbsp;Delete InsertNewProductionOrders&lt;BR&gt;&amp;nbsp;Where OrchestrationIdentifier = @orchestrationIdentifier&lt;BR&gt;&amp;nbsp;if @@error &amp;lt;&amp;gt; 0 goto err_handler&lt;BR&gt;End&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Return 0&lt;/P&gt;
&lt;P&gt;err_handler:&lt;/P&gt;
&lt;P&gt;Return -1&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Implementation Three and Four : Singleton Orchestrations Instances of the Map Splitter and Sql Helper Splitter&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;For those not familiar with BizTalk, multiple instances of the same orchestration type can be running simultaneously. For example, if the Map Splitter Orchestration subscribes to a receive port that has just accepted two large production order xml messages, two separate running instances of the Map Splitter Orchestration will be launched simultaneously to process the two messages (Note: this is not always true and is dependent on server load). Both the Splitter Orchestration using a map and Splitter Orchestration using a Sql Helper Database are resource intensive at certain point(s) during their lives as orchestration instances. If multiple orchestration instances are running simultaneously on the same BizTalk host instance machine, then at some point the host instance may run out of memory or CPU cycles. Details about when and why these patterns are resource intensive will be discussed below in the results section. To help alleviate the problem, one solution is to configure an orchestration to limit itself to one running instance. One straightforward method is as below: &lt;/P&gt;
&lt;P&gt;1) A correlation type in an orchestration is created as below. CorrelationTypeForSingletonReceive is configured to correlate for all incoming messages on a physical receive port that an orchestrations logical receive port is bound to. &lt;BR&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SplitterCompareCorrelationType.jpg"&gt;&lt;/P&gt;
&lt;P&gt;2) A Correlation Set is created in the orchestration that derives from the correlation type that was discussed above:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SplitterCompareCorrelationSet.jpg"&gt;&lt;/P&gt;
&lt;P&gt;3) The first Receive Shape in the orchestration will initialize the above correlation set. No more orchestration instances of this type will be launched until this orchestration has completed.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SplitterCompareOrcSplitOne.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;4) An outer loop (Loop for Singleton) is then invoked with an expression of 1 == 1. This never ending loop will process all incoming production order messages, but will process only one at a time. Two nested loops are contained within the outer loop. Loop for Distinct Orders (collapsed in the below image) contains the necessary shapes to split and send out messages. Loop For Subsequent Messages will then pick up a new production order message that is ready for processing, but will only do so when the previous message has been completely processed and split into the 51 separate&amp;nbsp; messages. A receive shape in this loop has its Follow Correlation Set property set to the Correlation set that was derived in step 2) and initialized by the first receive shape of the orchestration. This will pick up a new production order message to process. &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SplitterCompareOrcSplitTwo.jpg"&gt;&lt;/P&gt;
&lt;P&gt;5) Once a new incoming message is picked up, it will then go to the top of the outer loop to be split into separate messages.&lt;/P&gt;
&lt;P&gt;6) One problem with the above singleton orchestration, is that new production order messages may be received and queued up in the messagebox while the singleton orchestration is processing another production order message. These new production order messages are subscribed to by the running singleton orchestration instance. But if this orchestration instance fails, then these queued up unprocessed messages will be suspended, in an unconsumed state. These &lt;A href="http://blogs.msdn.com/biztalk_core_engine/archive/2004/06/30/169430.aspx"&gt;&lt;STRONG&gt;Zombie&lt;/STRONG&gt;&lt;/A&gt;&amp;nbsp;messages will then have be dealt with. In this implementation, a Catch block is used to catch any errors in the orchestration. Inside the catch block is a loop shape. A receive shape in this loop has its Follow Correlation Set property set to the Correlation set that was derived in step 2) and initialized by the first receive shape of the orchestration. This loop will then pick up any of the unconsumed messages. These unconsumed messages could then be submitted back to the singleton&amp;nbsp; orchestration. Additionally in BizTalk 2006, Suspended messages can be subscribed to by orchestrations, so it is possible that this technique could be used.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SplitterCompareOrcSplitThree.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Results of Splitter Tests&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Note: for all tests a series of System.Diagnostics.Debug.WriteLine were used in the orchestrations to capture the progress and processing times of the orchestration instances.&lt;BR&gt;&lt;A href="http://www.sysinternals.com/utilities/debugview.html"&gt;&lt;STRONG&gt;DebugView&lt;/STRONG&gt;&lt;/A&gt;, was used to view the WriteLine statements in real time.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;BizTalk 2004 Results&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The following hardware was used: Laptop with 2.0 GHz processor and 1GB of memory.&lt;BR&gt;Operating System :&amp;nbsp; Windows XP SP2&lt;BR&gt;This machine hosted the BizTalk server and a Sql Server with all the relevant BizTalk databases. The SplitterHelper database that is used by the orcSplitterUsingSql.odx and orcSplitterUsingSql_Singleton.odx orchestrations was installed on the BizTalk Server machine, but separate tests were also done with a remote SplitterHelper database installed on a Laptop with a 866 MHz processor and 512MB of memory. The BizTalk server machine and the remote Sql Server database were connected over a LAN.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Tests for processing One Message:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;In the below result table, only one 133 MB production order message was processed at a time. Only one orchestration was enlisted and started for each test. Total times begin when an orchestration instance starts and ends when the entire message has been split. They do not include the initial publication of the message into the messagebox. The split messages were not sent out through a send port. &lt;BR&gt;Note: The orchestrations can be configured to send out the split messages. &lt;BR&gt;Note: Orchestrations orcSplitterUsingMap_Singleton.odx and orcSplitterUsingSql_Singleton.odx are not included in the results because only one message&amp;nbsp; is being processed. They will have near identical results to orcSplitterUsingMap.odx and orcSplitterUsingSql.odx.&lt;/P&gt;
&lt;P&gt;Below is a legend for the tests:&lt;/P&gt;
&lt;P&gt;All times are in minutes:seconds, for example 3:45 &lt;/P&gt;
&lt;P&gt;&lt;U&gt;Orchestration Name: &lt;BR&gt;&lt;/U&gt;The name describes the pattern used.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Local SplitterHelper DB:&lt;BR&gt;&lt;/U&gt;For the Map pattern orchestrations, Not Applicable&lt;BR&gt;For the Sql pattern orchestrations, YES if a local SplitterHelper database was called on the BizTalk machine, NO if the SplitterHelper database was&amp;nbsp; called on the remote Sql Server SplitterHelper database.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Get Distinct Orders: &lt;BR&gt;&lt;/U&gt;For the Map pattern orchestrations, time to generate the distinct production order xml message using a map with a Custom XSLT template. &lt;BR&gt;For the Sql pattern orchestrations, time when the orchestration instance starts to when the .Net helper component returns the distinct production order&amp;nbsp;xml message to the calling orchestration. This time includes the SplitterHelper Database processing.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Time to Split:&lt;BR&gt;&lt;/U&gt;For the Map pattern orchestrations, time to split out all 51 messages using a map.&lt;BR&gt;For the Sql pattern orchestrations, time to split out all 51 messages using the SplitterHelper database&amp;nbsp;GetSplitProductionOrderMessage stored procedure.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Total Time:&lt;/U&gt;&lt;BR&gt;For all patterns, total time to process the entire message.&lt;/P&gt;
&lt;TABLE&gt;
&lt;COLGROUP&gt;
&lt;COL style="WIDTH: 164pt; mso-width-source: userset; mso-width-alt: 8009" width=219&gt;
&lt;COL style="WIDTH: 190pt; mso-width-source: userset; mso-width-alt: 9252" width=253&gt;
&lt;COL style="WIDTH: 130pt; mso-width-source: userset; mso-width-alt: 6326" width=173&gt;
&lt;COL style="WIDTH: 87pt; mso-width-source: userset; mso-width-alt: 4242" width=116&gt;
&lt;COL style="WIDTH: 90pt; mso-width-source: userset; mso-width-alt: 4388" width=120&gt;
&lt;TBODY&gt;
&lt;TR style="HEIGHT: 12.75pt" height=17&gt;
&lt;TD class=xl268146 style="WIDTH: 164pt; HEIGHT: 12.75pt" width=219 height=17&gt;&lt;STRONG&gt;Orchestration Name&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD class=xl278146 style="WIDTH: 190pt" width=253&gt;&lt;STRONG&gt;Local SplitterHelper DB&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD class=xl268146 style="WIDTH: 130pt" width=173&gt;&lt;STRONG&gt;Get Distinct Orders&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD class=xl268146 style="WIDTH: 87pt" width=116&gt;&lt;STRONG&gt;Time to Split&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD class=xl268146 style="WIDTH: 90pt" width=120&gt;&lt;STRONG&gt;Total Time&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="HEIGHT: 12.75pt" height=17&gt;
&lt;TD class=xl258146 style="HEIGHT: 12.75pt" height=17&gt;orcSplitterUsingMap.odx&lt;/TD&gt;
&lt;TD class=xl258146&gt;N/A&lt;/TD&gt;
&lt;TD class=xl248146 x:num="0.35833333333333334"&gt;8:36&lt;/TD&gt;
&lt;TD class=xl248146 x:num="0.5756944444444444"&gt;13:49&lt;/TD&gt;
&lt;TD class=xl248146 x:num="0.92708333333333337"&gt;22:15&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="HEIGHT: 12.75pt" height=17&gt;
&lt;TD class=xl258146 style="HEIGHT: 12.75pt" height=17&gt;orcSplitterUsingSQL.odx&lt;/TD&gt;
&lt;TD class=xl258146&gt;Yes&lt;/TD&gt;
&lt;TD class=xl248146 x:num="0.12569444444444444"&gt;3:01&lt;/TD&gt;
&lt;TD class=xl248146 x:num="0.16250000000000001"&gt;3:54&lt;/TD&gt;
&lt;TD class=xl248146 x:num="0.28819444444444448"&gt;6:55&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="HEIGHT: 12.75pt" height=17&gt;
&lt;TD class=xl258146 style="HEIGHT: 12.75pt" height=17&gt;orcSplitterUsingSQL.odx&lt;/TD&gt;
&lt;TD class=xl258146&gt;No&lt;/TD&gt;
&lt;TD class=xl248146 x:num="0.18263888888888891"&gt;4:23&lt;/TD&gt;
&lt;TD class=xl248146 x:num="5.5555555555555552E-2"&gt;1:20&lt;/TD&gt;
&lt;TD class=xl248146 x:num="0.23819444444444446"&gt;5:43&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;U&gt;Discussion of Results&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;orcSplitterUsingMap &lt;BR&gt;&lt;/U&gt;&lt;/STRONG&gt;The CPU was pinned at 100% the entire time this orchestration was running. The map to get the distinct list of production orders and the map to split out the orders are responsible for the CPU utilization.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;The good:&lt;/U&gt; &lt;BR&gt;a) The whole splitting operation is contained within this orchestration. This simplifies administration and maintenance operations.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;The bad : &lt;BR&gt;&lt;/U&gt;a) With The CPU pinned at 100%, this limits and/or slows down other operations on the BizTalk server.&lt;BR&gt;b) The total time for the orchestration to complete is not stellar at over 22 minutes.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;orcSplitterUsingSql (local SplitterHelper DB)&lt;/U&gt;&lt;/STRONG&gt; &lt;/P&gt;
&lt;P&gt;While the above orcSplitterUsingMap is CPU intensive, the orcSplitterUsingSql is memory intensive, for the following reasons:&lt;BR&gt;a) The operation to load the message in an XML Dom in the orchestration, uses a large amount of memory as the&amp;nbsp;OuterXml is passed to the .NET helper component. &lt;BR&gt;b) The OpenXML call in stored procedure -&amp;gt; InsertProductionOrders , uses a large amount of memory&amp;nbsp; (basically the same reason as above) and is also CPU intensive.&amp;nbsp;&lt;BR&gt;&lt;BR&gt;&lt;U&gt;The good:&lt;BR&gt;&lt;/U&gt;a) This pattern is much faster. Taking only approximately 5-6 minutes to complete. &lt;BR&gt;Note: Sometimes this pattern took longer, up to 12 minutes, because BizTalk was hogging all the memory and&amp;nbsp; would not give up enough memory to Sql Server and the SplitterHelper database. But the remote Splitter Database had much better results. See below.&lt;BR&gt;b) The CPU is not pinned at 100%.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;The bad:&lt;BR&gt;&lt;/U&gt;a) Uses quite a bit of memory. If more than one orcSplitterUsingSql instance is running simultaneously on the same server instance, then there will be&amp;nbsp;out of memory issues. (This will be discussed in more detail below)&lt;BR&gt;b) The Sql OpenXML call is memory and CPU intensive. (But the SplitterHelper database can be installed on another machine than the BizTalk Server. See below )&lt;BR&gt;c) The SplitterHelper database is just something else to maintain. Even though it is only a temporary/scratch database, for a fully fault tolerant&amp;nbsp; solution, this database should be installed in a clustered environment.&lt;BR&gt;d) The structure of this production order message is simple and the Sql OpenXML call is relatively straightforward to write. But with a more complicated message, there would be more T-SQL to write in the stored procedures.&lt;BR&gt;e) The split messages in this case are simple in structure and a For XML Auto clause is sufficient to return the proper xml. For more structurally complex split messages, a For XML Auto clause might not be able to return the desired XML. To get more control of the returned XML, a &lt;A href="http://objectsharp.com/blogs/matt/archive/2005/03/22/1560.aspx"&gt;&lt;STRONG&gt;For XML&amp;nbsp;Explicit&lt;/STRONG&gt;&lt;/A&gt; clause can be used.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Note: The new XML features in Sql 2005 will help tremendously in processing XML messages in Sql Server.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;orcSplitterUsingSql (remote SplitterHelper DB) &lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The above results for orcSplitterUsingSql (local SplitterHelper DB) can be applied here also. The only difference is that the SplitterHelper database is located on a different physical server than the BizTalk Server. When the Sql&amp;nbsp; OpenXML call is executed, the high memory and CPU needs of this operation will be applied to this remote sql server instead of the BizTalk Server.&amp;nbsp; This helps the BizTalk server a great deal as this heavy Sql OpenXML processing is delegated to another server. Comparing times, orcSplitterUsingSql (remote SplitterHelper DB) in general has better times (4-5 minutes)&amp;nbsp; compared to the (5-6) minutes for the orcSplitterUsingSql (local SplitterHelper DB). Obviously having the SplitterHelper database on another physical machine helps tremendously. The Sql Server installed on the BizTalk machine has to process the persistence points and other BizTalk operations. Therefore having the SplitterHelper database installed on another machine really helps. &lt;BR&gt;Note: Better times can be realized, the remote lightweight machine hosting the SplitterHelper database was a laptop with a only a 866MHz processor and 512MB of memory.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Test for processing Two Simultaneous Messages:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The same hardware set up was used as the tests for processing one message.&lt;/P&gt;
&lt;P&gt;For more of a real world scenario, two identical 133 MB large messages were submitted simultaneously to be processed at the same time. Only one orchestration type was enlisted and started for each test. Only the total time to split the two messages are recorded in the below table. Total times begin when the first orchestration instance starts and ends when the two messages have been split. They do not include the initial publication of the message into the messagebox. The split messages were not sent out through a send port. A file receive location was used to submit the two messages at the same time. The receive location was first disabled, two 133MB messages were copied into the folder. The receive location was then enabled. &lt;/P&gt;
&lt;TABLE&gt;
&lt;COLGROUP&gt;
&lt;COL style="WIDTH: 164pt; mso-width-source: userset; mso-width-alt: 8009" width=219&gt;
&lt;COL style="WIDTH: 190pt; mso-width-source: userset; mso-width-alt: 9252" width=253&gt;
&lt;COL style="WIDTH: 130pt; mso-width-source: userset; mso-width-alt: 6326" width=173&gt;
&lt;TBODY&gt;
&lt;TR style="HEIGHT: 12.75pt" height=17&gt;
&lt;TD class=xl2610358 style="WIDTH: 164pt; HEIGHT: 12.75pt" width=219 height=17&gt;&lt;FONT color=#000000&gt;&lt;STRONG&gt;Orchestration Name&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD class=xl2710358 style="WIDTH: 190pt" width=253&gt;
&lt;P align=center&gt;&lt;FONT color=#000000&gt;&lt;STRONG&gt;Local SplitterHelper DB&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD class=xl2610358 style="WIDTH: 130pt" width=173&gt;&lt;FONT color=#000000&gt;&lt;STRONG&gt;Total Time To Process&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="HEIGHT: 12.75pt" height=17&gt;
&lt;TD class=xl2510358 style="HEIGHT: 12.75pt" height=17&gt;orcSplitterUsingMap.odx&lt;/TD&gt;
&lt;TD class=xl2510358&gt;
&lt;P align=center&gt;N/A&lt;/P&gt;&lt;/TD&gt;
&lt;TD class=xl2810358&gt;45:23&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="HEIGHT: 12.75pt" height=17&gt;
&lt;TD class=xl2510358 style="HEIGHT: 12.75pt" height=17&gt;orcSplitterUsingMap_Singleton.odx&lt;/TD&gt;
&lt;TD class=xl2510358&gt;
&lt;P align=center&gt;N/A&lt;/P&gt;&lt;/TD&gt;
&lt;TD class=xl2510358 x:num&gt;42.11&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="HEIGHT: 12.75pt" height=17&gt;
&lt;TD class=xl2510358 style="HEIGHT: 12.75pt" height=17&gt;orcSplitterUsingSQL.odx&lt;/TD&gt;
&lt;TD class=xl2510358&gt;
&lt;P align=center&gt;Yes&lt;/P&gt;&lt;/TD&gt;
&lt;TD class=xl2410358 x:num="0.9506944444444444"&gt;22:49&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="HEIGHT: 12.75pt" height=17&gt;
&lt;TD class=xl2510358 style="HEIGHT: 12.75pt" height=17&gt;orcSplitterUsingSQL.odx&lt;/TD&gt;
&lt;TD class=xl2510358&gt;
&lt;P align=center&gt;No&lt;/P&gt;&lt;/TD&gt;
&lt;TD class=xl2410358 x:num="0.94861111111111107"&gt;22:46&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="HEIGHT: 12.75pt" height=17&gt;
&lt;TD class=xl2510358 style="HEIGHT: 12.75pt" height=17&gt;orcSplitterUsingSQL_Singleton.odx&lt;/TD&gt;
&lt;TD class=xl2510358&gt;
&lt;P align=center&gt;Yes&lt;/P&gt;&lt;/TD&gt;
&lt;TD class=xl2410358 x:num="0.57916666666666672"&gt;13:54&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="HEIGHT: 12.75pt" height=17&gt;
&lt;TD class=xl2510358 style="HEIGHT: 12.75pt" height=17&gt;orcSplitterUsingSQL_Singleton.odx&lt;/TD&gt;
&lt;TD class=xl2510358&gt;
&lt;P align=center&gt;No&lt;/P&gt;&lt;/TD&gt;
&lt;TD class=xl2410358 x:num="0.48472222222222222"&gt;11:38&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;U&gt;Discussion of Results &lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;U&gt;orcSplitterUsingMap&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Two instances of this orchestration were launched simultaneously. While watching the debug window, the two orchestrations ran neck and neck, basically splitting the exact same message at the same time. The memory on my machine was just about maxed out. If I added a third message to be processed, I do believe the machine would have run out of memory. The time to split two messages basically doubled, from splitting one message.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Goods and Bads:&lt;/U&gt; Basically the same comments as with the one message tests (see above)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;orcSplitterUsingMap_Singleton&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;As explained above, this orchestration is configured to only ever allow one running instance of itself. Therefore it had similar results to the single message tests. The times were just doubled as two large messages were processed sequentially. From above, two instances of the orcSplitterUsingMap could be running at the same time, but any more and the orcSplitterUsingMap_Singleton will have to be used. &lt;/P&gt;
&lt;P&gt;&lt;U&gt;Goods and Bads:&lt;/U&gt; Basically the same comments as with the one message tests (see above)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;orcSplitterUsingSql (local SplitterHelper DB)&amp;nbsp; and orcSplitterUsingSql (remote SplitterHelper DB)&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Grouped these two together because they had very similar results. This was fun to watch in the debug window. Two orcSplitterUsingSql orchestration instances would be started up at almost exactly the same time. I then had debug statements to see when the .Net helper component was called by the orchestration instances. Both orchestration instances would then try to call it a the same time, but there was just not enough memory to go around, and one instance eventually won out and started to call the stored procedure on the SplitterHelper Database. In HAT, I could see the losing orchestration instance &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_prog_orch_rwjd.asp"&gt;&lt;STRONG&gt;dehydrating and rehydrating&lt;/STRONG&gt;&lt;/A&gt; for another retry at the atomic scope shape. The losing instance upon rehydration, would then start at the&amp;nbsp;top of the orchestration (last &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_prog_orch_rrdy.asp"&gt;&lt;STRONG&gt;persistence&lt;/STRONG&gt;&lt;/A&gt; point). This pattern repeated a few times, with the dehydration and rehydration of the loser orchestration instance. The winning orchestration instances call to the .Net helper component completed and now the losing orchestration instance started again to call the .Net helper component. The winning orchestration instance was now in a position to start splitting messages. The winning instance would split between 0 and 17 messages, and the loser instance would repeat the cycle of trying to call the .Net Helper&amp;nbsp; component, dehydrate and then rehydrate. Eventually, nothing was happening, but then the BizTalk host instance automatically recycled itself (see below&amp;nbsp; error messages and warnings from the event log). After the host instance recycled and started up, the loser orchestration instance successfully called&amp;nbsp; the .Net Helper component, and then the two orcSplitterUsingSql instances happily started calling the Splitter Database at the same time to split their respective messages. &lt;/P&gt;
&lt;P&gt;Below are some of the errors from the event log before the automatic recycling of the BizTalk host instance:&lt;/P&gt;
&lt;P&gt;The Messaging Engine received an error from a transport adapter while notifying it with the BatchComplete event.&lt;/P&gt;
&lt;P&gt;The Messaging Engine failed while writing tracking information to the database&lt;/P&gt;
&lt;P&gt;The Messaging Engine encountered an error while deleting one or more messages&lt;/P&gt;
&lt;P&gt;The Messaging Engine failed to retrieve the configuration from the database&lt;/P&gt;
&lt;P&gt;There was a failure executing the receive pipeline: "Microsoft.BizTalk.DefaultPipelines.XMLReceive" Source: "XML disassembler" Receive Location:&amp;nbsp; "SQL://redlake/SplitterHelper/" Reason: Exception of type System.OutOfMemoryException was thrown&lt;/P&gt;
&lt;P&gt;The Messaging engine failed to process a message submitted by adapter:SQL Source URL:SQL://redlake/SplitterHelper/. Details:Could not find a matching&amp;nbsp; subscription for the message. This error occurs if the subscribed orchestration schedule or send port has not been started, or if some of the message&amp;nbsp;properties necessary for subscription evaluation have not been promoted. Please refer to Health and Activity Tracking tool for more detailed information&amp;nbsp;on this failure&lt;/P&gt;
&lt;P&gt;Finally two warning messages appeared in the event log, announcing the recycling of the BizTalk server instance:&lt;/P&gt;
&lt;P&gt;All receive locations are being temporarily disabled because either the MessageBox or Configuration database is not available. When these databases&amp;nbsp;become available, the receive locations will be automatically enabled.&lt;/P&gt;
&lt;P&gt;An error has occurred that requires the BizTalk service to terminate. The most common causes are an unexpected out of memory error and an inability to&amp;nbsp;connect or a loss of connectivity to one of the BizTalk databases.&amp;nbsp; The service will shutdown and auto-restart in 1 minute. If the problematic database&amp;nbsp;remains unavailable, this cycle will repeat.&lt;/P&gt;
&lt;P&gt;Note: No split messages were lost or duplicated when the host instance was recycled. BizTalk maintains the state of the orchestration instances with&amp;nbsp; persistence points.&lt;/P&gt;
&lt;P&gt;Note: I sometimes became impatient waiting for the host instance to recycle itself. I then went into the Windows Task Manager and clicked on the Processes Tab. I would them find BTSNTSvc.exe process, right mouse buttoned on it to launch the pop up menu and clicked on End Process to terminate&amp;nbsp; the BizTalk host instance (Note: This is a real nasty thing to do and I do not recommend it). After manually terminating the BTSNTSvc.exe process the&amp;nbsp;host instance automatically restarted itself and then finished off processing the two orchestration instances.&lt;/P&gt;
&lt;P&gt;Note: As explained above, the two orchestration instances were able to successfully complete after the host instance was recycled. One of the problems (I think), was that the winning orchestration instance was still holding onto a good chunk of memory (even after it called the .Net Helper component). But&amp;nbsp;after the host instance recycled, the losing orchestration instance was able to get enough memory to process.&lt;/P&gt;
&lt;P&gt;Note : As explained above the .Net Helper component is called within an Atomic Scope shape. A property on the Atomic Scope shape is called Batch and can be set to either True or False. If this property was set to True, and two orcSplitterUsingSql instances are running, only one instance is allowed to call the .Net Helper component and the other has to wait (I observed this by having a Debug statement inside the&amp;nbsp; .Net Helper component). If it is set to False, then by watching the debug statements, both can call it simultaneously. Either way, true of false, the host instance had the same behavior of recycling itself. Setting it to True might be more beneficial in this case. &lt;A href="http://www.geekswithblogs.com/toddu/archive/2004/11/24.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt; is a scenario where you might want to set it to False.&lt;/P&gt;
&lt;P&gt;Note: Sometimes both orchestration instances dehydrated and rehydrated a number of times before one successfully called the .Net Helper component. The different patterns of dehydrating and rehydrating were observed when the batch property on the atomic scope shape was changed and when the two orchestration instances were launched at different times.&lt;/P&gt;
&lt;P&gt;Note: &lt;A href="http://geekswithblogs.net/sthomas/archive/2005/03/29/27655.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt; is another scenario similar to the above on processing and mapping a large message.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;The good:&lt;/U&gt; &lt;BR&gt;a) The good news is that no messages were lost, due to persistence points, and both orchestrations instances successfully completed. But other than that, there is really nothing good here. &lt;/P&gt;
&lt;P&gt;&lt;U&gt;The bad:&lt;/U&gt; &lt;BR&gt;a) Recycling of BizTalk Hosts instances on a regular basis, is not acceptable in a production environment.&lt;BR&gt;b) This is not a good pattern for multiple simultaneous large messages to be processed. If there was multiple instances running in the Host, then they could share the load and take on one large message each. But at some point there might be more large&amp;nbsp; messages to process then available host instances (also you might run out of money buying more Enterprise versions of BizTalk Server). More memory on the BizTalk machine might help also. Moving the BizTalk databases to another physical machine would also help.&lt;BR&gt;Note: One fix is to allow only one running singleton instance of this orchestration (see below).&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;orcSplitterUsingSql_Singleton (local SplitterHelper DB)&amp;nbsp; and orcSplitterUsingSql_Singleton (remote SplitterHelper DB)&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;As explained above, this orchestration is configured to only ever allow one running instance of itself. Therefore it had similar results to the single message tests. The times were just doubled as two large messages were processed sequentially. &lt;/P&gt;
&lt;P&gt;&lt;U&gt;The Good: &lt;BR&gt;&lt;/U&gt;1) This pattern can handle simultaneous large&amp;nbsp; messages, by processing one at a time.&lt;BR&gt;2) This pattern is much less CPU intensive then the map patterns. &lt;BR&gt;3) Other orchestrations and operations can be running on the BizTalk server, while the sql splitter orchestration instance is splitting messages.&lt;BR&gt;4) The host did not recycle, because only one orcSplitterUsingSql_Singleton orchestration instance is ever running.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;The Bad:&lt;/U&gt;&lt;BR&gt;Basically the same comments as with the one message tests (see above)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;The overall winner:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;If more than one large message is being submitted in the same timeframe, then the singleton orchestrations must be used. This is somewhat dependent on hardware for each BizTalk instance and the number of BizTalk instances assigned to the host running the orchestrations. The performance and time winner is clearly the orcSplitterUsingSql_Singleton (remote SplitterHelper DB), but the downside to this method is that a SplitterHelper database must be maintained and the extra code (.Net and T-Sql) that must be written to get this to work. Additionally, performance will be improved if the SplitterHelper database is installed on a dedicated machine.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;BizTalk 2006 Tests&lt;/U&gt;&lt;/STRONG&gt; &lt;/P&gt;
&lt;P&gt;Some of the same tests were performed against the BizTalk 2006 installation. BizTalk 2006 was installed on a VPC Windows 2003 image (running on a Windows XP host) with only 700MB assigned to the VPC image. The BizTalk 2006 installation was handicapped compared to the BizTalk 2004 installation and not all the tests were run. Until the tests using BizTalk 2006 can be performed on the same hardware as the BizTalk 2004 installation, the comparisons are not&amp;nbsp;accurate.&lt;/P&gt;
&lt;P&gt;The patterns I do have results for are as below (one message being processed): &lt;/P&gt;
&lt;P&gt;orcSplitterUsingMap -&amp;gt; 48:36 &lt;BR&gt;orcSplitterUsingSql (remote SplitterHelper DB) -&amp;gt; 17:01&lt;/P&gt;
&lt;P&gt;Some of the observations I did make are:&lt;BR&gt;The map to get the distinct list of production orders was much quicker on BizTalk 2006. 2 minutes compared to over 8 minutes on BizTalk 2004. When Splitting the messages using a map, the CPU was not pinned, but this mapping operation was very slow. I am attributing it to the fact that BizTalk 2006 being installed on a VPC image with only 700MB of memory assigned to it.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Final Thoughts&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;From reading -&amp;gt; &lt;A href="http://blogs.msdn.com/biztalk_core_engine/archive/2005/02/28/381700.aspx"&gt;&lt;STRONG&gt;Large messages in BizTalk 2004, what's the deal?&lt;/STRONG&gt;&lt;/A&gt; it discusses&amp;nbsp; &lt;BR&gt;performance problems processing large messages with BizTalk 2004. Therefore, something to consider is using Sql Server to help with message processing in BizTalk: &lt;BR&gt;1) This post has discussed, a BizTalk splitter pattern that has used Sql Server to help process a large message. &lt;BR&gt;2) This &lt;A href="http://geekswithblogs.net/asmith/archive/2005/06/06/42281.aspx"&gt;&lt;STRONG&gt;POST&lt;/STRONG&gt;&lt;/A&gt; discusses using Sql Server to help with a BizTalk aggregator pattern.&lt;BR&gt;3) This&lt;A href="http://blogs.conchango.com/davemorris/archive/2005/02/21/1039.aspx"&gt; &lt;STRONG&gt;POST&lt;/STRONG&gt;&lt;/A&gt; discusses processing a large flat file using a Sql Server BCP operation to help split the message.&amp;nbsp;&lt;BR&gt;4) A future title of a post could be: Extending BizTalk Mapping and Transformations using Sql Server 2000/2005. A good demo for this future post, would be passing two large XML messages down into a Sql Server stored procedure, then using T-Sql to perform the actual mapping of the messages.&lt;BR&gt;5) As mentioned above. Sql 2005 has quite of number of improvements and enhancements for processing XML.&lt;/P&gt;
&lt;P&gt;I really would like to try the tests discussed in this entry on a proper BizTalk 2006 installation (I just do not have the time or spare machine to do so at the moment).&amp;nbsp; From reading the documentation and from my few observations, there are real performance improvements with large messages and BizTalk 2006.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Please read all the posts in the below blogs. These are written by the BizTalk team members at Microsoft. Having an understanding of how BizTalk works internally is a must before you start your first BizTalk project.&lt;BR&gt;&lt;A href="http://blogs.msdn.com/biztalkperformance/"&gt;&lt;STRONG&gt;BizTalk Performance Blog:&lt;/STRONG&gt;&lt;/A&gt;&lt;BR&gt;&lt;A href="http://blogs.msdn.com/biztalk_core_engine/"&gt;&lt;STRONG&gt;Core Engine Blog&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The below whitepaper is a good read for performance and BizTalk&lt;BR&gt;&lt;A href="http://www.gotdotnet.com/team/wsservers/bts2004/BTS2004Performance.zip"&gt;&lt;STRONG&gt;Microsoft BizTalk Server 2004 Performance Characteristics Whitepaper&lt;BR&gt;&lt;BR&gt;&lt;/STRONG&gt;&lt;/A&gt;You can download the samples discussed above &lt;A href="http://www.objectsharp.com/blogs/matt/images/BtsCompareSplitterPatterns.zip"&gt;&lt;STRONG&gt;&lt;FONT color=#800080&gt;HERE&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/A&gt; LINK and try on a BizTalk 2004 and/or BizTalk 2006 installation. Read the &lt;A href="http://www.objectsharp.com/blogs/matt/images/BtsCompareSplitterPatternsReadMe.txt"&gt;&lt;STRONG&gt;&lt;FONT color=#800080&gt;ReadMe.Txt&lt;/FONT&gt;&lt;/STRONG&gt; &lt;/A&gt;before installing and running.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=3209" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>BizTalk Schema Presentation</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2005/06/27/2599.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2005/06/27/2599.aspx</id><published>2005-06-27T14:41:00Z</published><updated>2005-06-27T14:41:00Z</updated><content type="html">&lt;P&gt;I am doing a BizTalk Presentation on Wed June 29 in Toronto.&lt;BR&gt;Details can be found below.&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;Theme for the night -&amp;gt; &lt;STRONG&gt;BizTalk Schema DeepDive &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;First Presentation:&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;STRONG&gt;An Introduction to BizTalk Schemas&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;One of the first steps in designing a Messaging or Integration system is to have an understanding of &lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;the messages that will exchanged between the various participating applications.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;A paradigm to describe this is SOA (Service Oriented Architecture) and Contract First. In BizTalk, Schemas are used to &lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;define the XML, Flat File, EDI, and other types of messages that will be exchanged between the various applications. &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;Some of the topics discussed and demonstrations will include:&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;1) Why we need Schemas from a Business perspective and BizTalk perspective.&lt;BR&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;2) Various methods to create XML Schemas in the BizTalk development environment.&lt;BR&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;3) Using xsd schemas from other sources.&lt;BR&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;4) Uses for Schemas in BizTalk.&lt;BR&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;5) Property Schemas in BizTalk.&lt;BR&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;6) How to split messages in BizTalk using an Envelope Schema. &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;Second Presentation:&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;STRONG&gt;BizTalk&amp;nbsp;Schemas and Non XML Message Formats&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;In Today's world, many different types of messages formats exist, for example Flat File, EDI, HL7. &lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;A .NET object can also be used to represent and store information about a particular message. &lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;In BizTalk, there are many mechanisms in place to create and consume these various types of messages.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;Some of the topics discussed and demonstrations will include:&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;1) Creating Schemas to represent XML that will be deserialized into .NET objects and &lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;to represent xml serialized from .Net Objects&lt;BR&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;2) Flat File Schema Creation&lt;BR&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;3) Other Types of Schemas (for example HL7) that are available in BizTalk Accelerators.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;To sign up please go here to the Toronto BizTalk Usergroup site:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.btug.biz/"&gt;http://www.btug.biz/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=2599" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>BizTalk -&gt; More on Constructing Messages and Configuration Information for an Orchestration</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2005/06/16/2270.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2005/06/16/2270.aspx</id><published>2005-06-16T19:18:00Z</published><updated>2005-06-16T19:18:00Z</updated><content type="html">&lt;P&gt;I recently was reading Scott's entry on Constructing Messages from Scratch with Embedded Resources. This is a good method, so take a look a look at it &lt;A href="http://www.traceofthought.net/PermaLink,guid,c1164c59-72e2-49e2-be7a-47e4e8dc46d4.aspx"&gt;HERE&lt;/A&gt;. &lt;BR&gt;Below is a variant on &lt;A href="http://objectsharp.com/Blogs/matt/archive/2004/11/09/1009.aspx"&gt;Constructing Messages in an Orchestration&lt;/A&gt;. This also can be used as a method to read any type of configuration information into an Orchestration.&lt;BR&gt;This method needs:&lt;/P&gt;
&lt;P&gt;1) A Sql Server table to store the templates for the XML Messages and/or Configuration Information.&lt;BR&gt;2) A BizTalk XML Schema.&lt;BR&gt;3) A BizTalk Map.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;U&gt;A Sql Server Table&lt;/U&gt;&lt;/STRONG&gt;&lt;BR&gt;Below is a create statement for the table with three columns:&lt;/P&gt;
&lt;P&gt;if exists (select * from dbo.sysobjects where id = object_id(N'[GenericCodes]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)&lt;BR&gt;drop table [GenericCodes]&lt;BR&gt;GO&lt;/P&gt;
&lt;P&gt;CREATE TABLE [GenericCodes] (&lt;BR&gt;&amp;nbsp;[Code] [varchar] (50)&amp;nbsp; NOT NULL ,&lt;BR&gt;&amp;nbsp;[Value] [varchar] (7000)&amp;nbsp; NOT NULL ,&lt;BR&gt;&amp;nbsp;[Description] [varchar] (500) NULL ,&lt;BR&gt;&amp;nbsp;CONSTRAINT [PK_GenericCodes] PRIMARY KEY&amp;nbsp; CLUSTERED &lt;BR&gt;&amp;nbsp;(&lt;BR&gt;&amp;nbsp;&amp;nbsp;[Code]&lt;BR&gt;&amp;nbsp;)&amp;nbsp; ON [PRIMARY] &lt;BR&gt;) ON [PRIMARY]&lt;BR&gt;GO&lt;/P&gt;
&lt;P&gt;Some sample data for the table is as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/BizConfigDatabase.jpg"&gt;&lt;/P&gt;
&lt;P&gt;a) The Code column is the Primary Key of the table that describes the contents of the row.&lt;BR&gt;b) The Value column contains the actual template XML message or Configuration value.&lt;BR&gt;c) The Description&amp;nbsp;column contains a description/purpose of the template xml message or configuration value, &lt;BR&gt;&amp;nbsp;&lt;BR&gt;In the example sample data above, the first two rows:&lt;/P&gt;
&lt;P&gt;BaseXML_401ExtraInfoRequest&lt;BR&gt;BaseXML_401FlatFileTemplate&lt;/P&gt;
&lt;P&gt;contain template xml for messages that need to be constructed from scratch in an orchestration, sample as below:&lt;/P&gt;
&lt;P&gt;&amp;lt;ns0:ShippingInfo ShipToAddress="Some Address" ShipToCity="Some City" ShipToCountry="Some Country" xmlns:ns0="http://ConstructingXMLMessages.ShippingInfo" /&amp;gt; &lt;/P&gt;
&lt;P&gt;The remainder of the rows, contains configuration information for a process:&lt;/P&gt;
&lt;P&gt;Request401_FIFOMIBSend -&amp;gt; How many Processor orchestrations can be running at one time (1 or many)&lt;BR&gt;Request401_MaxNumberofFilesToBatch -&amp;gt; How many incoming messages to batch together using a looping sequential convoy&lt;BR&gt;Request401_TestMode -&amp;gt; To indicate if the system is in test mode or production mode.&lt;BR&gt;Request401_TimeoutForFileBatching -&amp;gt; The max time to wait for the next message to batch.&lt;BR&gt;Response401_DB2Process401Results_CommandTimeout -&amp;gt; Passed to a ADO.Net Helper component to update a DB2 database.&lt;BR&gt;Response401_DB2Process401Results_Retries -&amp;gt; Used to configure a Component Retry Pattern.&lt;BR&gt;Response401_DB2Process401Results_RetryInterval -&amp;gt; Used to configure a Component Retry Pattern.&lt;BR&gt;TwoDigitYearSupport -&amp;gt; To help translate two digit years to four digit years in a map.&lt;BR&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;A BizTalk XML Schema&lt;BR&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;BR&gt;Create a BizTalk Schema called XmlTemplateAndConfigInfo.xsd as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/BizConfigSchema.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Each node (could be an element or attribute) is of Data Type string. Notice that each nodes name matches a Code column name from a row in the Configuration table.&lt;BR&gt;(Note: For this method to work, It is important to match the names. This will be explained below)&lt;BR&gt;Each node is promoted to a distinguished field.&lt;BR&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;A BizTalk Map&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;&lt;BR&gt;&lt;/U&gt;&lt;/STRONG&gt;Create a BizTalk Map called Map_PopulateXMLTemplateAndConfigInfo.btm as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/BizConfigFinalMap.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Notice that the source and destination schemas use the same schema (XmlTemplateAndConfigInfo.xsd) that was described above.&lt;/P&gt;
&lt;P&gt;A DataBase Lookup Functoid and Value Extractor functoid are used to populate each node on the Destination Schema. &lt;/P&gt;
&lt;P&gt;The Configuration information for a DataBase lookup functoid looks like below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/BizConfigDataBaseLookup.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The first Input parameter for a DataBase lookup functoid is the lookup value. In this case it should be set to a value of a row from the Primary Key Code column in the configuration table GenericCodes. Instead of Hard Coding this value in for example (Request401_TestMode), a link from the source schema is used. When the link has been created, go to the properties window as below and for the Source Links property set the value to -&amp;gt; Copy name. Therefore instead of the value of the source node being mapped over, the name of the node will be mapped over. This is why it is important for the name of each node to match a rows Code value in the GenericCodes table.&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/BizConfigMapCopyName.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The second Input parameter for a DataBase Lookup functoid is the DataBase Connection string A UDL file was used to hold the connection string for the database as described &lt;A href="http://dallas.sark.com/SarkBlog/mholdorf/archive/2005/03/08/953.aspx"&gt;HERE&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;A Value Extractor Functoid is then used to extract the XML Template or Configuration Value and map it the Destination node.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/BizConfigValueExtractor.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;U&gt;A Sample Orchestration to use the XML templates and Configuration Values&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Sample Orchestration as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/BizConfigOrchestration.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The following Messages and Variables are created in the Orchestration View for the Orchestration:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/BizConfigOrchestrationView.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Messages:&lt;BR&gt;msgEmptyXmlTemplateAndConfigInfo MessageType is set to the XmlTemplateAndConfigInfo.xsd schema discussed above.&lt;BR&gt;msgPopulatedXmlTemplateAndConfigInfo MessageType is set to the XmlTemplateAndConfigInfo.xsd schema discussed above.&lt;BR&gt;msgCreateFromXMLTemplate is a test message that is constructed from an XML Template.&lt;/P&gt;
&lt;P&gt;Variables:&lt;BR&gt;Both varXMLDomEmptyXmlTemplateAndConfigInfo and varXMLDomCreateFromXMLTemplate are variables of type -&amp;gt; System.Xml.XmlDocument&lt;BR&gt;They are used to help in message construction.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;1) In the First construct shape in the Orchestration -&amp;gt; Construct EmptyXmlTemplateConfigInfo&lt;BR&gt;A Message Assignment shape is used to construct message -&amp;gt; msgEmptyXmlTemplateAndConfigInfo &lt;BR&gt;The code in the Message Assignment is as below:&lt;/P&gt;
&lt;P&gt;// First need an empty message to construct the Empty Config Info XML Message&lt;BR&gt;// Note: The XML is just the Root Node Name and the target namespace of the schema XmlTemplateAndConfigInfo.xsd&lt;BR&gt;// This is hardcoded, but should never change.&lt;BR&gt;// This constructed message is needed in the next orchestration shape which uses a map to construct the msgPopulatedXmlTemplateAndConfigInfo&amp;nbsp; &lt;BR&gt;// message.&lt;BR&gt;varXMLDomEmptyXmlTemplateAndConfigInfo.LoadXml(@"&amp;lt;ns0:XmlTemplateAndConfigInfo xmlns:ns0=""http://Demo.XmlTemplateAndConfigInfo""/&amp;gt;");&lt;BR&gt;msgEmptyXmlTemplateAndConfigInfo = varXMLDomEmptyXmlTemplateAndConfigInfo;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;2) In the Second construct shape -&amp;gt; Construct PopulatedXmlTemplateConfigInfo&lt;BR&gt;A Transform shape is used to construct message -&amp;gt; msgPopulatedXmlTemplateAndConfigInfo.&lt;/P&gt;
&lt;P&gt;The map -&amp;gt; Map_PopulateXMLTemplateAndConfigInfo.btm is used in the transform shape.&lt;BR&gt;Message msgEmptyXmlTemplateAndConfigInfo is used as the Transform Source Message&lt;BR&gt;Message msgPopulatedXmlTemplateAndConfigInfo is used as the Transform Destination Message&amp;nbsp; &lt;/P&gt;
&lt;P&gt;The map -&amp;gt; Map_PopulateXMLTemplateAndConfigInfo.btm will then be invoked to construct the &lt;BR&gt;msgPopulatedXmlTemplateAndConfigInfo. The nodes in this message will be populated from the values in Sql &lt;BR&gt;table GenericCodes.&lt;/P&gt;
&lt;P&gt;3) In the third construct shape, this is an example of constructing a message from an XML template,&lt;BR&gt;that originates from the Sql table GenericCodes.&lt;BR&gt;A Message assignment shape is used to construct message -&amp;gt; msgCreateFromXMLTemplate&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;// Load the Template XML from the msgPopulatedXmlTemplateAndConfigInfo.BaseXML_401ExtraInfoRequest node.&lt;BR&gt;// Because Distinguished fields are used, then the intellisense works as below&lt;BR&gt;varXMLDomCreateFromXMLTemplate.LoadXml(msgPopulatedXmlTemplateAndConfigInfo.BaseXML_401ExtraInfoRequest);&lt;BR&gt;msgCreateFromXMLTemplate = varXMLDomCreateFromXMLTemplate;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;4) Below is an example of reading the msgPopulatedXmlTemplateAndConfigInfo for Configuration information.&lt;BR&gt;The Decide shape (Decide If In Test Mode, Test Mode Rule) uses the following expression to determine if in test mode:&lt;/P&gt;
&lt;P&gt;// Intellisense can be used because the Nodes in the XmlTemplateAndConfigInfo.xsd were promoted as &lt;BR&gt;// Distinguished Fields. &lt;BR&gt;msgPopulatedXmlTemplateAndConfigInfo.Request401_TestMode == "1"&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;U&gt;Finally&lt;BR&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The good things about this method are:&lt;/P&gt;
&lt;P&gt;1) No Code. You do not have to write any .Net Helper code to help read in the XML templates and Configuration Values into an Orchestration.&lt;BR&gt;2) This is a simple method that I originally used at a client where .NET skills were scarce. Therefore why burden them with .NET code to maintain/test etc. when they do not have the resources to do so. &lt;BR&gt;3) As soon as the value in the GenericCode tables changes it will be automatically&amp;nbsp;visible.&lt;BR&gt;4) A tool such as Query Analyzer or the Sql Enterprise Manager can be used to change the XML Template and Configuration values in the database.&lt;BR&gt;5) This is a central repository of configuration data that any BizTalk Server in the Group will point to.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;The not so good things about this method are:&lt;/P&gt;
&lt;P&gt;1) For each node to be populated in the Map_PopulateXMLTemplateAndConfigInfo.btm map, a separate round trip to the database must be done. But we are talking milliseconds.&lt;/P&gt;
&lt;P&gt;2) Each orchestration that needs the configuration values, would have to add the necessary Construct shapes to invoke the Population map. But, it would be easy to create one orchestration to centralize this procedure and then let the other orchestrations call into this "Configuration Orchestration" using a Call Orchestration Shape. The "Configuration Orchestration" would then return an msgPopulatedXmlTemplateAndConfigInfo message as an out parameter.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Just a Note&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I always try to do a bit of research on my Blog topics so I can point the reader to other techniques and different views. So below are some links to other blogs on BizTalk and Configuration. Depending on your needs, take your pick:&lt;/P&gt;
&lt;P&gt;1) &lt;A href="http://geekswithblogs.net/gwiele/archive/2004/11/17/15168.aspx"&gt;The BizTalk Configuration Dilemma &lt;/A&gt;&lt;BR&gt;2) &lt;A href="http://geekswithblogs.net/nparker/archive/2004/10/25/13196.aspx"&gt;Using the Rules Engine for orchestration configuration values *BizTalk Sample*... &lt;/A&gt;&lt;BR&gt;3&lt;A href="http://blogs.msdn.com/scottwoo/archive/2004/01/28/63940.aspx"&gt;).NET configuration files with Orchestration Hosts&amp;nbsp; &lt;/A&gt;&lt;BR&gt;4) &lt;A href="http://www.masteringbiztalk.com/blogs/jon/PermaLink,guid,6e4b84db-d15f-45e9-b245-08b1eb6c4def.aspx"&gt;How to store configuration data in the Enterprise Single Sign-On Database (SSO) &lt;BR&gt;&lt;/A&gt;5)&amp;nbsp; &lt;A href="http://www.canonical-ltd.com/modules.php?name=Content&amp;amp;pa=showpage&amp;amp;pid=4"&gt;Using the BTSNTSvc.exe.config&lt;BR&gt;&lt;/A&gt;6) Maybe BizTalk 2006, has some new features for configuration? Just &lt;BR&gt;installed my copy and have not had the time to look yet.&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=2270" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>Calling an Oracle Stored Procedure from a Sql Server 2000 Stored Procedure using a Linked Server</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2005/06/13/2221.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2005/06/13/2221.aspx</id><published>2005-06-14T01:07:00Z</published><updated>2005-06-14T01:07:00Z</updated><content type="html">&lt;P&gt;I had to to this a while back -&amp;gt; Calling an Oracle stored procedure from a Sql Server stored procedure. The Oracle stored procedure accepted a number of parameters from the Sql Server stored procedure. The Oracle stored procedure would then execute and pass back a result set to the Sql Server calling procedure. A linked server was used in Sql Server to call the Oracle stored procedure. This is just to save anybody the pain in case they need to set this up.&lt;/P&gt;
&lt;P&gt;This is a step by step example on how to set up the server where the Oracle database is installed &lt;BR&gt;and the server where the Sql Server is installed. It also provides a test Sql Server stored proc calling an Oracle stored proc with parameters, with a result set being passed back to Sql Server.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;The following are the steps necessary to call an Oracle Stored Procedure from Sql Server.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;The test was done with two separate computers as below.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Pre Set Up:&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Machine 1) &lt;o:p&gt;&lt;/o:p&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Windows XP , with Oracle Standard Server 8.1.7 installed.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Note: Other versions of Oracle may work.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Machine 2) &lt;o:p&gt;&lt;/o:p&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Windows XP , with Sql Server 2000 installed.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;U&gt;Machine 1) Oracle&lt;o:p&gt;&lt;/o:p&gt;&lt;/U&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;1)&lt;/B&gt; Make sure the Distributed Transaction Coordinator Service is running.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;2)&lt;/B&gt; Run the following Below Oracle Packages and Procs into the Oracle Instance.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Note :The Oracle stored procedure that Sql Server calls must be within a package.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;IN parameters can be passed into the Oracle Stored Procedure, but any results &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;should be passed back in a ReturnVal OUT Table type parameter. &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;-----------------------------------------------------------------------&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;CREATE OR REPLACE PACKAGE CallFromSqlServerPackage&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;AS&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;TYPE SqlReturnTbl IS TABLE OF Varchar(500)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;/* The index is important, otherwise {resultset} doesn't work. */&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;INDEX BY BINARY_INTEGER;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;PROCEDURE OracleProc&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;(&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Param1 IN varchar2,&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Param2 IN varchar2,&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Param3 IN varchar2,&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Param4 IN varchar2,&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;ReturnVal OUT SqlReturnTbl&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;END CallFromSqlServerPackage;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;/&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;CREATE OR REPLACE PACKAGE BODY CallFromSqlServerPackage&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;AS&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;PROCEDURE OracleProc&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;(&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Param1 IN varchar2,&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Param2 IN varchar2,&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Param3 IN varchar2,&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Param4 IN varchar2,&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;ReturnVal OUT SqlReturnTbl&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;IS&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Begin&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;/* From this package would call out to the Oracle Proc that would do the actual work */&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;/* IN and OUT type parameters could be used to pass data out and get data back in from this Oracle SP.*/&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;/* For example the call to the other proc would look like the below */&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN lang=PT-BR style="mso-ansi-language: PT-BR"&gt;/* SomeRealSP( Param1, Param2, Param3, Param4 ); */&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN lang=PT-BR style="mso-ansi-language: PT-BR"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;/* From the results from the above proc, place into the TABLE that will be returned, */&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;/* back to the calling Sql Server Proc. All data passed back would have to be in a Character format */&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;/* If necessary, the Sql Server Stored procedure, would have to convert the data into Integers/ Datetimes etc. */&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;/* The Sql Server Proc, would have to know the positions of the data in the rows returned back from Oracle. */&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ReturnVal( 1 ) := 'Some Character Data';&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ReturnVal( 2 ) := '340';&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ReturnVal( 3 ) := '100.22';&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ReturnVal( 4 ) := 'Dec 22 2004';&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;/* Below was test to see if doing a Rollback on the Sql Server Side, would roll this back */&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;/* If a Rollback was issued in the Sql Server proc, then the below statement was rolled back */ &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;/* Insert into SCOTT.ACCOUNT values (3000,5); */&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;End OracleProc;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;End CallFromSqlServerPackage;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;/&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;U&gt;Machine 2) Sql Server&lt;o:p&gt;&lt;/o:p&gt;&lt;/U&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;The following Steps were followed as detailed below: &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;(How to set up and troubleshoot a linked server to Oracle in SQL Server) :&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;A href="http://support.microsoft.com/kb/280106"&gt;http://support.microsoft.com/kb/280106&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;1)&lt;/B&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The Oracle Client Software (8.1.7) was installed.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;2)&lt;/B&gt; Install MDAC version 8, as outlined in the KB article&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=6c050fe3-c795-4b7d-b037-185d0506396c&amp;amp;DisplayLang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyID=6c050fe3-c795-4b7d-b037-185d0506396c&amp;amp;DisplayLang=en&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;3)&lt;/B&gt; Modify the registry as outlined in the KB article.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;4)&lt;/B&gt; Restart the Server.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;5)&lt;/B&gt; After the server is re-started make sure that the Distributed Transaction Coordinator Service is running.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;6)&lt;/B&gt; The PATH System variable was edited, so the Sql Server Path, preceded the Oracle Path(s), see below: &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;The C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\oracle\ora81\bin;C:\Program Files\Oracle\jre\1.1.7\bin; &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;7)&lt;/B&gt; A Service Naming Entry was created as below, to connect to the proper Oracle Instance on Machine 1)&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/CallOracleSPNetAssist.jpg"&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;8)&lt;/B&gt; The following statement was run in Query Analyzer, to set up the correct linked server:&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Use master&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;go&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;EXEC sp_addlinkedserver&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;'Ora817Link',&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;'Oracle',&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;'MSDAORA',&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;'test2'&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;go&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Note: that Ora817Link, is the name of the Linked Server Entry, test2, is the name of the Service Naming entry that was created above in Step 7)&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;9)&lt;/B&gt; Create the Credentials that will be used&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;by the Linked Server to connect to the Oracle Server&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Use master&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;go&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;/* Below will set the Credentials&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;*/&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;EXEC sp_addlinkedsrvlogin 'Ora817Link', 'FALSE',NULL, 'scott', 'tiger'&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Go&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;10)&lt;/B&gt; Run the following stored Procedure into Sql&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Server&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;SET QUOTED_IDENTIFIER ON &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;GO&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;SET ANSI_NULLS ON &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;GO&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CallOracleProcTest]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;drop procedure [dbo].[CallOracleProcTest]&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;GO&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;CREATE Proc CallOracleProcTest&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;As&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;declare @createdTran tinyint&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Set @createdTran = 0&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;-- Note : This must be set in order for Transactions to be Started and Rollbacked properly&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;SET XACT_ABORT ON&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;-- Starting a Transaction, Note: this is optional.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;-- This technique, just describes how to test to see &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;-- if a transaction has already been started, by the caller&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;-- If not, then start the transaction. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;If @@trancount = 0&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Begin&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Begin Transaction&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Set @createdTran = 1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;End&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;-- Use the below temp table, to capture the results returned back from the call to the Oracle Proc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Create table #test (indicator int identity(1,1),&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Oracle_Result varchar(500))&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Declare @parma1ForOracle varchar(100),&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;@parma2ForOracle varchar(100),&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;@parma3ForOracle varchar(100),&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;@parma4ForOracle varchar(100)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Set @parma1ForOracle = '1'&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;set @parma2ForOracle = '100.2'&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;set @parma3ForOracle = 'This is info for Oracle test'&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;set @parma4ForOracle = 'Dec 12 2004'&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;/* NOTE: Below would build the Dynamic Sql Statement. Parameters passed to Oracle are built into the Dynamic Sql*/&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;/* Results from Call are placed into a Temp table. NOTE: That the position of the passed back info, would have &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;to be know by this proc*/&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;/* Note that resultset 25 , signifies that &amp;lt;= 25 rows can be returned back from the Oracle Stored proc*/&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Declare @OracleCall varchar(8000)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;set @OracleCall = 'Insert into #test(Oracle_Result) SELECT * FROM OPENQUERY(ORA817Link , ''{CALL SCOTT.CallFromSqlServerPackage.OracleProc('&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=DA style="mso-ansi-language: DA"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;set @OracleCall = @OracleCall + ''''''+ @parma1ForOracle + '''''' &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=DA style="mso-ansi-language: DA"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;set @OracleCall = @OracleCall + ',' + '''''' +&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;@parma2ForOracle + '''''' &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=DA style="mso-ansi-language: DA"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;set @OracleCall = @OracleCall + ',' + '''''' +&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;@parma3ForOracle + '''''' &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=DA style="mso-ansi-language: DA"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;set @OracleCall = @OracleCall + ',' + '''''' +&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;@parma4ForOracle + '''''' &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;set @OracleCall = @OracleCall + ',{resultset 25, ReturnVal})}'')'&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;-- Below is where actually call the Oracle stored procedure.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=DE style="mso-ansi-language: DE"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;exec (@OracleCall)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=DE style="mso-ansi-language: DE"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;if @@error &amp;lt;&amp;gt; 0&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;goto err_handler&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=DE style="mso-ansi-language: DE"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=DE style="mso-ansi-language: DE"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;-- Now get the info passed back from the oracle stored procedure. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;-- Note: Must know the row number of the data passed back from the oracle stored procedure,&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;-- and its type.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Declare @parma1FromOracle varchar(100),&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;@parma2FromOracle integer,&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;@parma3FromOracle real,&lt;SPAN style="mso-tab-count: 1"&gt; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;@parma4FromOracle datetime&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Select @parma1FromOracle = Oracle_Result &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;From #test&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Where indicator = 1&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;if @@error &amp;lt;&amp;gt; 0&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;goto err_handler&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Select @parma2FromOracle = Convert(int,Oracle_Result) &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;From #test&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Where indicator = 2&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;if @@error &amp;lt;&amp;gt; 0&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;goto err_handler&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face="Courier New" size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Select @parma3FromOracle = Convert(real,Oracle_Result) &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;From #test&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Where indicator = 3&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;if @@error &amp;lt;&amp;gt; 0&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;goto err_handler&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Select @parma4FromOracle = Convert(datetime,Oracle_Result) &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;From #test&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Where indicator = 4&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;if @@error &amp;lt;&amp;gt; 0&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;goto err_handler&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;print 'Result of @parma1FromOracle = ' + ltrim(rtrim(@parma1FromOracle))&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;print 'Result of @parma2FromOracle = ' + ltrim(rtrim(str(@parma2FromOracle)))&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;print 'Result of @parma3FromOracle = ' + ltrim(rtrim(Convert(varchar(30),@parma3FromOracle)))&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;print 'Result of @parma4FromOracle = ' + ltrim(rtrim(Convert(varchar(30),@parma4FromOracle)))&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;if @createdTran = 1 and @@trancount &amp;gt; 0 &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Begin&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Commit Transaction&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;End&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;SET XACT_ABORT OFF&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;return 0&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;err_handler:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;print 'Error in proc'&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;if @createdTran = 1 and @@trancount &amp;gt; 0 &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Begin&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Rollback Transaction&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;End&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;SET XACT_ABORT OFF&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Return - 1&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;GO&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;SET QUOTED_IDENTIFIER OFF &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;GO&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;SET ANSI_NULLS ON &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;GO&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;11) &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/B&gt;Test the Procedure :&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;begin tran&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;exec CallOracleProcTest&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;rollback tran&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=2221" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Database Related" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Database+Related/default.aspx" /></entry><entry><title>BizTalk 2004 -&gt; Integrating with Sharepoint 2003 and when NOT to use the BizTalk WSS Adapter</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2005/06/08/2114.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2005/06/08/2114.aspx</id><published>2005-06-08T16:16:00Z</published><updated>2005-06-08T16:16:00Z</updated><content type="html">&lt;P&gt;The Sharepoint Send/Receive Adapter released last March of 2004 on GotDotNet can be downloaded &lt;A href="http://www.gotdotnet.com/workspaces/releases/viewuploads.aspx?id=0d1aa85c-cf8d-497e-84f4-3ffec8db115f"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;.&lt;BR&gt;It provides functionality to add (Send) items from BizTalk into Sharepoint Libraries and to pull (Receive) items that have been added into a Sharepoint Library and to submit them into the BizTalk environment. The Sharepoint Adapter is a great example of how a custom BizTalk 2004 Adapter can be built to allow BizTalk to communicate with any type of application.&lt;/P&gt;
&lt;P&gt;Last year in 2004, I was part of a team working on a Sharepoint 2003 Portal/BizTalk 2004 project. BizTalk 2004 was used to integrate an HR (Human Resources) system with Sharepoint WSS libraries and Sharepoint Portal User Profiles. In fact, BizTalk was used to aid in the replication of the data from the HR system (in real time) to the Sharepoint Portal Server (i.e. any changes to the HR Employee Profiles (updates/inserts/deletes) were to be replicated in a timely manner to the Sharepoint Portal Server(s) WSS Lists and/or User Profiles).&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;More Specifically:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;1) Employee profiles from the HR system were inserted, updated and deleted in a Sharepoint Library Lists.&lt;BR&gt;2) Employee Resumes (doc,pdf,rtf formats) from the HR system were inserted,updated and deleted in Sharepoint Document Library Lists. &lt;BR&gt;3) Employee Photos (tiff,jpg formats) from the HR System were inserted updated and deleted in Sharepoint Picture Library Lists.&amp;nbsp; &lt;BR&gt;4) Employee profiles from the HR system were used to create, update and delete Sharepoint User Profiles and to also generate MySites for each User Profile. &lt;BR&gt;Note: User Profiles and MySites is a feature of Sharepoint Portal Server 2003 and not Windows Sharepoint Services (WSS). User Profiles can be used to store information about each portal user. Additionally each portal user can have their own MySite, where they can add/modify and delete their own specific content and have control of their own Web Site within the portal.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;Some of the specific requirements/functionality/infrastructure of the integration project:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;1) There were two Sharepoint 2003 Portal Servers:&lt;BR&gt;a) English Portal Server (The English Portal Server was a load balanced web farm implemented with two physical servers hosting the English Portal.)&lt;BR&gt;b) French Portal Server&lt;/P&gt;
&lt;P&gt;2) &lt;BR&gt;a) The English portal hosted the English User Profiles and English MySites.&lt;BR&gt;On the English Portal there were two main WSS sub sites -&amp;gt; an English Sub Site and a French Sub Site. &lt;BR&gt;Note: there was some discussion on moving the French Sub Site to the Physical French Portal server, but at the time of development the English and French Sub Sites were on the English Portal. Therefore the Employee profile, Resume and Picture libraries were duplicated on the English and French Sub sites of the English portal.&lt;BR&gt;Note: We were trying to have one main list with both the English and French columns at the portal level and then create views of the this main list down on the English and French Sub Sites. This did not work. Therefore the duplicate libraries -&amp;gt; one on each sub site was used as below:&lt;/P&gt;
&lt;P&gt;English Employee List:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SPIntegrationEmployeeListEN.jpg"&gt;&lt;/P&gt;
&lt;P&gt;French Employee List:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SPIntegrationEmployeeListFR.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;b) The French Portal Server hosted the French User Profiles and MySites&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;3) Any change made about an employee on the HR System (insert/update/delete), was to be replicated across to the Sharepoint Employee Profile List.&lt;/P&gt;
&lt;P&gt;4) Any change to an Employee&amp;nbsp;Picture or Employee&amp;nbsp;Resume on the HR System (insert/update/delete), was to be replicated across to the Sharepoint Employee&amp;nbsp;Picture Libraries and Resume Libraries. A Document or Picture Library can be thought of a regular Sharepoint list, except that a File is also associated with the list.&lt;/P&gt;
&lt;P&gt;Additionally the HR system could indicate if only the actual Resume file or Picture file changed or only if text information about the the Employees changed (ie, their name or the city they worked in). This could be used to aid in performance -&amp;gt; i.e. if only the persons name changed, then do not bother updating the actual Resume Binary or Picture Binary and only update the Sharepoint List text columns (i.e. First Name, Last Name, City).&lt;/P&gt;
&lt;P&gt;Below is the Detail View of the English Picture Library:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SPIntegrationPictureDetails.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Below is the ThumbNail View of the English Picture Library:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SPIntegrationPictureThumb.jpg"&gt;&lt;/P&gt;
&lt;P&gt;5) When a File is added to a Document library, an actual URL (for example: http://spserver/sites/EnglishSite/EmployeePictures/Bob.jpg)&amp;nbsp; &lt;BR&gt;is generated that can be retrieved from a Sharepoint API method call as below:&lt;/P&gt;
&lt;P&gt;url = spListItem.File.ServerRelativeUrl;&lt;/P&gt;
&lt;P&gt;This URL was sent back to the calling BizTalk Orchestration, so that it could ultimately update a Sharepoint Portal Server User Profile URL property. For example, one of the default properties for UserProfiles is the picture URL. When the MySite of the user is navigated to, the picture url is used to automatically display the picture on the users MySite as below:&lt;/P&gt;
&lt;P&gt;Below is the edit page for Bob the Builder's User Profile:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SPIntegrationUserProfile.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Below is the MySite for Bob The Builder.&lt;BR&gt;Note: That the User Profile for Bob the Builder is used to populate the MySite.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SPIntegrationMySite.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;6) If the particular Sharepoint Library did not exist, then automatically create it.&lt;BR&gt;For example if BizTalk submitted an Employee Profile(s) to Sharepoint for processing and the particular library list did not exist, then:&amp;nbsp; &lt;BR&gt;a) Automatically create the list.&lt;BR&gt;b) Populate the list from the submitted HR profile(s).&lt;/P&gt;
&lt;P&gt;7) Any change made about an employee on the HR System (insert/update/delete), was to be replicated across to the Sharepoint User Profile Database.&lt;/P&gt;
&lt;P&gt;8) A possible future enhancement was to have the information about Resumes also stored in Sharepoint Portal Areas. In this implementation Areas were used to represent the taxonomy of the company.&lt;/P&gt;
&lt;P&gt;From the above functionality and requirements it became clear that it was going to be difficult or impossible to use the existing WSS adapter directly. Much finer grained control of the Sharepoint functionality was needed in order to implement the system.&lt;BR&gt;Therefore there were two choices:&lt;/P&gt;
&lt;P&gt;Choice 1) Extend the WSS BizTalk Adapter to handle the additional functionality.&lt;BR&gt;Choice 2) Let Biztalk call custom web methods hosted by web services installed on Sharepoint Portal Servers. The custom web methods would receive as parameters information about employees in an XML format and additionally binary employee resumes and pictures. Custom code in the web methods would utilize the Sharepoint API methods in order to insert/update/delete items in the Sharepoint Lists and the Sharepoint User Profiles. The Web Methods could also return results, such as the URL's of the pictures or resumes to set into Sharepoint Portal User Profile properties. &lt;/P&gt;
&lt;P&gt;In the end choice 2) was chosen to implement the solution. &lt;BR&gt;The particular customer where I was doing the work had a number of strong .NET/Sharepoint/Web Services developers so it ultimately can down to the lead developers choice and he preferred choice number 2). &lt;/P&gt;
&lt;P&gt;Choice 1), is also a viable option, but in retrospect, I am thankful that the custom web services method was chosen. Each Sharepoint List had it's own little quirks and the functionality to populate them varied from list to list. In the end it was much easier to have a separate set of web methods to control the population of each Sharepoint list and&amp;nbsp; the Portal User Profiles. To make the code more modular, a common set of Sharepoint helper methods was used, so that&amp;nbsp; code did not have to be duplicated, from web method to web method. If there were more Sharepoint Lists to be populated and the number of list to be populated grew over time, then&amp;nbsp;using an adapter becomes more attractive. One of the things you lose by writing custom web methods, is that each List is tightly bound to a web method, so if the number of Sharepoint lists grow then the number of web methods also grows.&lt;/P&gt;
&lt;P&gt;Below is a more detailed discussion of how the Custom Code was implemented and discusses in some detail using the Sharepoint API. Additionally at the end of this blog you can download the code that populates the Sharepoint Employee List.&lt;/P&gt;
&lt;P&gt;A simplified flow of information from the HR System to Sharepoint went something like this:&lt;/P&gt;
&lt;P&gt;1) From the HR System, information about the employees was delivered into Biztalk in an XML format.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;2) A BizTalk Orchestration would then subscribe to the incoming Employee message. &lt;/P&gt;
&lt;P&gt;A simplified Employee XML message is as below:&lt;/P&gt;
&lt;P&gt;&amp;lt;ns0:EmployeeProfiles xmlns:ns0="http://BobTheBuilder"&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;EmployeeProfile&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;EMPLOYEE_ID&amp;gt;1&amp;lt;/EMPLOYEE_ID&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;LAST_NAME&amp;gt;The Builder&amp;lt;/LAST_NAME&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;FIRST_NAME&amp;gt;Bob&amp;lt;/FIRST_NAME&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;PHONE&amp;gt;111-1111&amp;lt;/PHONE&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;CITY&amp;gt;Toronto&amp;lt;/CITY&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;FUNCTION&amp;gt;Owner&amp;lt;/FUNCTION&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;PROCESSLISTINDICATOR&amp;gt;-1&amp;lt;/PROCESSLISTINDICATOR&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;/EmployeeProfile&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;EmployeeProfile&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;EMPLOYEE_ID&amp;gt;2&amp;lt;/EMPLOYEE_ID&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;LAST_NAME&amp;gt;The Contractor&amp;lt;/LAST_NAME&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;FIRST_NAME&amp;gt;Wendy&amp;lt;/FIRST_NAME&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;PHONE&amp;gt;222-2222&amp;lt;/PHONE&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;CITY&amp;gt;Mississauga&amp;lt;/CITY&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;FUNCTION&amp;gt;Contractor&amp;lt;/FUNCTION&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;PROCESSLISTINDICATOR&amp;gt;-1&amp;lt;/PROCESSLISTINDICATOR&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;/EmployeeProfile&amp;gt;&lt;BR&gt;&amp;lt;/ns0:EmployeeProfiles&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;The XML was converted to a string in the BizTalk Orchestration Expression shape. An example is as below. &lt;/P&gt;
&lt;P&gt;varXMLDomEmployee = msgEmployee;&lt;BR&gt;// Now the following can be used to extract the XML as a string&lt;BR&gt;strEmployeeXML = varXMLDomEmployee.OuterXML.&lt;BR&gt;More details about the above can be found &lt;A href="http://objectsharp.com/Blogs/matt/archive/2004/10/30/989.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;If the Employee information was associated with a Resume, or a Picture, then in the Orchestration a .NET Helper Component using ADO.NET was called to retrieve the file from Sql Server. The code would return the Resume or Picture Binary as a string, from a Sql Server text column . An excerpt of the code is as below:&lt;/P&gt;
&lt;P&gt;string result;&lt;BR&gt;System.Byte[] resumeImageBytes; &lt;BR&gt;resumeImageBytes =&amp;nbsp; (System.Byte[]) this.sqlCmdGetResumeImage.ExecuteScalar();&lt;BR&gt;result = System.Convert.ToBase64String(resumeImageBytes);&lt;BR&gt;return result;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) The string of Employee XML and optionally the Base64String of the Employee Resume or Picture was then sent to the Sharepoint Portal Servers from the BizTalk Orchestration via a Web Port to a Web Service installed on the Sharepoint Portal Servers. More detail about this can be found &lt;A href="http://objectsharp.com/Blogs/matt/archive/2004/10/21/952.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;4) The particular web method on the portal Server would then accept as parameters the string of XML and optionally the binary Resume or Picture (as a string). &lt;/P&gt;
&lt;P&gt;5) On the Web Server side, strongly typed datasets were used to&amp;nbsp;hold configuration information for the Sharepoint Lists/Portal User Profiles&amp;nbsp;and also included mapping&amp;nbsp;information between the incoming&amp;nbsp;Employee XML and the Sharepoint List Columns/ User Profile Properties.&amp;nbsp;The dataset is as below.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SPIntegrationConfigDataSet.jpg"&gt;&lt;/P&gt;
&lt;P&gt;XML installed on the Web Service side would then populate the dataset. A&amp;nbsp;sample of the XML to populate the dataset is as below:&lt;/P&gt;
&lt;P&gt;&amp;lt;?xml version="1.0" standalone="yes" ?&amp;gt;&lt;BR&gt;&amp;lt;SharePointListData xmlns="http://tempuri.org/SharePointListData.xsd"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;SharePointList&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointListID&amp;gt;1&amp;lt;/SharePointListID&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;WebLocation&amp;gt;sites/EnglishSite&amp;lt;/WebLocation&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointListDescription&amp;gt;Employee Profiles List&amp;lt;/SharePointListDescription&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointListTitle&amp;gt;Employee Directory&amp;lt;/SharePointListTitle&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointListPKColumn&amp;gt;EmployeeID&amp;lt;/SharePointListPKColumn&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;XMLSourcePKColumn&amp;gt;EMPLOYEE_ID&amp;lt;/XMLSourcePKColumn&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TemplateName&amp;gt;Custom List&amp;lt;/TemplateName&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Language&amp;gt;en&amp;lt;/Language&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;/SharePointList&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointColumnName&amp;gt;EmployeeID&amp;lt;/SharePointColumnName&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;XMLSourceColumnToMap&amp;gt;EMPLOYEE_ID&amp;lt;/XMLSourceColumnToMap&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointListID&amp;gt;1&amp;lt;/SharePointListID&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;/SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointColumnName&amp;gt;Last Name&amp;lt;/SharePointColumnName&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;XMLSourceColumnToMap&amp;gt;LAST_NAME&amp;lt;/XMLSourceColumnToMap&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointListID&amp;gt;1&amp;lt;/SharePointListID&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;/SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointColumnName&amp;gt;First Name&amp;lt;/SharePointColumnName&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;XMLSourceColumnToMap&amp;gt;FIRST_NAME&amp;lt;/XMLSourceColumnToMap&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointListID&amp;gt;1&amp;lt;/SharePointListID&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;/SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointColumnName&amp;gt;Phone&amp;lt;/SharePointColumnName&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;XMLSourceColumnToMap&amp;gt;PHONE&amp;lt;/XMLSourceColumnToMap&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointListID&amp;gt;1&amp;lt;/SharePointListID&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;/SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointColumnName&amp;gt;City&amp;lt;/SharePointColumnName&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;XMLSourceColumnToMap&amp;gt;CITY&amp;lt;/XMLSourceColumnToMap&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointListID&amp;gt;1&amp;lt;/SharePointListID&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;/SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointColumnName&amp;gt;Function&amp;lt;/SharePointColumnName&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;XMLSourceColumnToMap&amp;gt;FUNCTION&amp;lt;/XMLSourceColumnToMap&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointListID&amp;gt;1&amp;lt;/SharePointListID&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;/SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;SharePointList&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointListID&amp;gt;2&amp;lt;/SharePointListID&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;WebLocation&amp;gt;sites/FrenchSite&amp;lt;/WebLocation&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointListDescription&amp;gt;Les Profils d'employ&amp;#233; Enum&amp;#232;rent&amp;lt;/SharePointListDescription&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointListTitle&amp;gt;Annuaire d'employ&amp;#233;&amp;lt;/SharePointListTitle&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointListPKColumn&amp;gt;EmployeeID&amp;lt;/SharePointListPKColumn&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;XMLSourcePKColumn&amp;gt;EMPLOYEE_ID&amp;lt;/XMLSourcePKColumn&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;lt;TemplateName&amp;gt;Custom List&amp;lt;/TemplateName&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;lt;Language&amp;gt;fr&amp;lt;/Language&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;/SharePointList&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointColumnName&amp;gt;EmployeeID&amp;lt;/SharePointColumnName&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;XMLSourceColumnToMap&amp;gt;EMPLOYEE_ID&amp;lt;/XMLSourceColumnToMap&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointListID&amp;gt;2&amp;lt;/SharePointListID&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;/SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointColumnName&amp;gt;Nom de famille&amp;lt;/SharePointColumnName&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;XMLSourceColumnToMap&amp;gt;LAST_NAME&amp;lt;/XMLSourceColumnToMap&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointListID&amp;gt;2&amp;lt;/SharePointListID&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;/SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointColumnName&amp;gt;Pr&amp;#233;nom&amp;lt;/SharePointColumnName&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;XMLSourceColumnToMap&amp;gt;FIRST_NAME&amp;lt;/XMLSourceColumnToMap&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointListID&amp;gt;2&amp;lt;/SharePointListID&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;/SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointColumnName&amp;gt;T&amp;#233;l&amp;#233;phone&amp;lt;/SharePointColumnName&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;XMLSourceColumnToMap&amp;gt;PHONE&amp;lt;/XMLSourceColumnToMap&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointListID&amp;gt;2&amp;lt;/SharePointListID&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;/SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointColumnName&amp;gt;Ville&amp;lt;/SharePointColumnName&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;XMLSourceColumnToMap&amp;gt;CITY&amp;lt;/XMLSourceColumnToMap&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointListID&amp;gt;2&amp;lt;/SharePointListID&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;/SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;SharePointListColumns&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointColumnName&amp;gt;Fonction&amp;lt;/SharePointColumnName&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;XMLSourceColumnToMap&amp;gt;FUNCTION&amp;lt;/XMLSourceColumnToMap&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePointListID&amp;gt;2&amp;lt;/SharePointListID&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;/SharePointListColumns&amp;gt;&lt;BR&gt;&amp;lt;/SharePointListData&amp;gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above XML contains all the information necessary to create and/or get a handle to the necessary Sharepoint list(s) and contains the mappings between the incoming XML and the Sharepoint Columns. For example: The LAST_NAME node in the incoming XML would map to the Last Name column in the English Sharepoint list and would also map to the Nom de famille column in the French Sharepoint list. This configuration XML&amp;nbsp;was then stored in&amp;nbsp;the Web Services Cache. When the XML file changed, the File Dependency Cache would automatically load in the new XML file. In this way, the configuration information about the Sharepoint Lists and mappings could be changed on the fly.&lt;/P&gt;
&lt;P&gt;Below is Sample Web Dependency&amp;nbsp;Cache loading code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;result.ReadXml(System.Web.HttpContext.Current.Server.MapPath(fileName));&lt;BR&gt;// Save to the Web Cache. Put dependency on file, so when file is changed, old copy will get flushed from the Cache&lt;BR&gt;System.Web.HttpContext.Current.Cache.Insert(cacheKey,&lt;BR&gt;result,&lt;BR&gt;new System.Web.Caching.CacheDependency(System.Web.HttpContext.Current.Server.MapPath(fileName)));&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;6) The Web Method would then call a helper class, that would actually do the processing &lt;BR&gt;against the Sharepoint List(s)/User Profile&amp;nbsp;Database&amp;nbsp;with the Employee XML and the Configuration Dataset.&lt;/P&gt;
&lt;P&gt;a)&amp;nbsp;The Helper class would first determine if the required Sharepoint List(s)&amp;nbsp;existed. The configuration dataset contained the necessary information to create the Sharepoint List(s) if they did not exist, otherwise just get a handle to the existing list. The code to create the list looks something like the below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;try &lt;BR&gt;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;// If the below WSS list exists, then get it.&lt;BR&gt;&amp;nbsp;&amp;nbsp;employeeList = this.siteCollection[0].AllWebs[(sharepointListRow.WebLocation)].Lists[sharepointListRow.SharePointListTitle];&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;catch (System.ArgumentException ex)&lt;BR&gt;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;// Means the WSS list did not exist, therefore create it.&lt;BR&gt;&amp;nbsp;&amp;nbsp;employeeList = null;&lt;BR&gt;&amp;nbsp;&amp;nbsp;System.Diagnostics.Debug.WriteLine("The List does not exist. error is as follows -&amp;gt; " + ex.ToString());&amp;nbsp; &lt;BR&gt;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;if (employeeList == null)&lt;BR&gt;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;// Create the WSS List&lt;BR&gt;&amp;nbsp;&amp;nbsp;string listTitle="" ,listDescription = "";&lt;BR&gt;&amp;nbsp;&amp;nbsp;listTitle = sharepointListRow.SharePointListTitle;&lt;BR&gt;&amp;nbsp;&amp;nbsp;if (!sharepointListRow.IsSharePointListDescriptionNull())&lt;BR&gt;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;listDescription = sharepointListRow.SharePointListDescription;&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;listDescription = sharepointListRow.SharePointListTitle;&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;// This will add the new list to the List Collection of the Site.&lt;BR&gt;&amp;nbsp;&amp;nbsp;siteCollection[0].AllWebs[sharepointListRow.WebLocation].Lists.Add(listTitle,&amp;nbsp; // Title of New List&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; listDescription,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Description of the List&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Microsoft.SharePoint.SPListTemplateType.GenericList); // Type of list need to create&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;// This will get a handle to the just added list&lt;BR&gt;&amp;nbsp;&amp;nbsp;employeeList = siteCollection[0].AllWebs[sharepointListRow.WebLocation].Lists[listTitle];&lt;BR&gt;&amp;nbsp;&amp;nbsp;// Now add the necessary columns to the newly created list.&lt;BR&gt;&amp;nbsp;&amp;nbsp;// Also add the columns to the Default View of the List.&lt;BR&gt;&amp;nbsp;&amp;nbsp;// Note: This code only handles text type columns.&lt;BR&gt;&amp;nbsp;&amp;nbsp;Microsoft.SharePoint.SPView defaultView = employeeList.DefaultView;&lt;BR&gt;&amp;nbsp;&amp;nbsp;Microsoft.SharePoint.SPViewFieldCollection spViewFieldsCollect = defaultView.ViewFields;&lt;BR&gt;&amp;nbsp;&amp;nbsp;foreach (SharePointListData.SharePointListColumnsRow spColumn in sharepointListRow.GetSharePointListColumnsRows())&lt;BR&gt;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;employeeList.Fields.Add(spColumn.SharePointColumnName ,Microsoft.SharePoint.SPFieldType.Text,false);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;spViewFieldsCollect.Add(spColumn.SharePointColumnName);&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;defaultView.Update();&lt;BR&gt;&amp;nbsp;}&lt;/P&gt;
&lt;P&gt;b) The Helper class would then take the Configuration dataset and use it to map the Employee XML into the correct Sharepoint List columns. An indicator is also passed in with the employee XML. If it is set to -1, then the Employee in the Sharepoint list must be deleted, otherwise the Employee must be added to the list if it is not found or updated if it is found. A column in the Sharepoint list is used as a primary key for CAML Queries.&lt;/P&gt;
&lt;P&gt;public void setDataInEmployeeSPList(string employeeXml,Microsoft.SharePoint.SPList employeeList, SharePointListData.SharePointListRow sharepointListRow )&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;System.Xml.XmlElement employeeChildNode;&lt;BR&gt;&amp;nbsp;System.Xml.XmlDocument employee = new System.Xml.XmlDocument();&lt;BR&gt;&amp;nbsp;employee.LoadXml(employeeXml);&lt;BR&gt;&amp;nbsp;System.Xml.XmlNode xmlNode;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;xmlNode = employee.DocumentElement["PROCESSLISTINDICATOR"];&lt;BR&gt;&amp;nbsp;string deleteListIndicator = xmlNode.InnerText;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;xmlNode = employee.DocumentElement[sharepointListRow.XMLSourcePKColumn];&lt;BR&gt;&amp;nbsp;string employeeID = xmlNode.InnerText; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;Microsoft.SharePoint.SPListItem spListItemEmployee;&lt;BR&gt;&amp;nbsp;Microsoft.SharePoint.SPListItemCollection spListItemsEmployees;&lt;BR&gt;&amp;nbsp;// Call method that does CAML query to try to find the Employee in the list.&lt;BR&gt;&amp;nbsp;// If found, we will either update or delete it in the list.&lt;BR&gt;&amp;nbsp;spListItemsEmployees = this.QueryListForItems(employeeList,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharepointListRow.SharePointListPKColumn,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; employeeID);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;if (deleteListIndicator == "-1")&lt;BR&gt;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;if (spListItemsEmployees.Count == 1)&lt;BR&gt;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Means must delete the Employee from the list&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;spListItemEmployee = spListItemsEmployees[0];&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;employeeList.Items.DeleteItemById(spListItemEmployee.ID);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//employeeList.Update();&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Means could not find the item in the list to delete&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.Diagnostics.Debug.WriteLine("Could not find the Employee to delete in the library list.");&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;else // Either the Employee must be updated or deleted in the Employee list&lt;BR&gt;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;spListItemEmployee = null;&lt;BR&gt;&amp;nbsp;&amp;nbsp;switch (spListItemsEmployees.Count)&lt;BR&gt;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;case 1:&amp;nbsp; // Found an existing Employee -&amp;gt; Update&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.Diagnostics.Debug.WriteLine("Found in library");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;spListItemEmployee = spListItemsEmployees[0];&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;case 0: // Employee does not exist. Create a new employee item in the list&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.Diagnostics.Debug.WriteLine("Did not find in library");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;spListItemEmployee = employeeList.Items.Add();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;// Now set the information from the Employee XML to the Employee Sharepoint List Columns &lt;BR&gt;&amp;nbsp;&amp;nbsp;foreach (SharePointListData.SharePointListColumnsRow employeeColumnsRow in sharepointListRow.GetSharePointListColumnsRows())&lt;BR&gt;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;employeeChildNode = employee.DocumentElement[employeeColumnsRow.XMLSourceColumnToMap];&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (employeeChildNode != null)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;spListItemEmployee[employeeColumnsRow.SharePointColumnName] = employeeChildNode.InnerText;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;&amp;nbsp;&amp;nbsp;if (spListItemEmployee != null)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;spListItemEmployee.Update();&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;/// &amp;lt;summary&amp;gt;&lt;BR&gt;/// Will query a list in Sharepoint. Only one column in the list is queried. For example City = "Toronto"&lt;BR&gt;/// &amp;lt;/summary&amp;gt;&lt;BR&gt;/// &amp;lt;param name="listToQuery"&amp;gt;The SPList to query&amp;lt;/param&amp;gt;&lt;BR&gt;/// &amp;lt;param name="columnToQuery"&amp;gt;The name of the column to query in the SPList&amp;lt;/param&amp;gt;&lt;BR&gt;/// &amp;lt;param name="queryValue"&amp;gt;The value to query for in the column&amp;lt;/param&amp;gt;&lt;BR&gt;/// &amp;lt;returns&amp;gt;A collection of List items that were returned by the query&amp;lt;/returns&amp;gt;&lt;BR&gt;public Microsoft.SharePoint.SPListItemCollection QueryListForItems(Microsoft.SharePoint.SPList listToQuery,&lt;BR&gt;&amp;nbsp;string columnToQuery,&lt;BR&gt;&amp;nbsp;string queryValue)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;Microsoft.SharePoint.SPListItemCollection result;&lt;BR&gt;&amp;nbsp;Microsoft.SharePoint.SPQuery spQuery = new Microsoft.SharePoint.SPQuery();&lt;BR&gt;&amp;nbsp;spQuery.Query = "&amp;lt;Where&amp;gt;&amp;lt;Eq&amp;gt;&amp;lt;FieldRef Name='"+ columnToQuery +"'/&amp;gt;&amp;lt;Value Type='Text'&amp;gt;" +&amp;nbsp; queryValue + "&amp;lt;/Value&amp;gt;&amp;lt;/Eq&amp;gt;&amp;lt;/Where&amp;gt;";&lt;BR&gt;&amp;nbsp;result = listToQuery.Items.List.GetItems(spQuery);&lt;BR&gt;&amp;nbsp;return result;&lt;/P&gt;
&lt;P&gt;}&lt;BR&gt;&lt;BR&gt;c) In the end, there was not&amp;nbsp;too much&amp;nbsp;code to write, somewhere between 50 and 100 lines of code to get the job done.&lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;Some Notes about the Sharepoint API's&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;1) The Sharepoint API's will give the maximum amount of control over a WSS or Portal Site.&lt;BR&gt;2) In order to use the WSS&amp;nbsp;API you must make a reference to Microsoft.SharePoint.dll. The Sharepoint dll contains methods to interact with Sharepoint lists, Document/Picture libraries and much more.&lt;BR&gt;3) In order to use the Sharepoint Portal API you must make a reference to the Microsoft.SharePoint.Portal.dll. The Portal dll contains methods to interact with a portals User Profile database, areas and much more.&lt;BR&gt;4) The Sharepoint API's are organized into a series of collections. For example:&lt;BR&gt;a) A Portal contains a collection of WSS sites&lt;BR&gt;b) A WSS site contains a collection of Sharepoint Lists&lt;BR&gt;c) A Sharepoint List contains a collection of Sharepoint columns and Items that contains the data in the List&lt;BR&gt;5) The API's are fairly intuitive, but like everything have their own set of nuances.&lt;BR&gt;For example when&amp;nbsp;adding an new item into a Generic list, it looks something like the below:&lt;/P&gt;
&lt;P&gt;// Just add the new item to the Items collection of the list&lt;BR&gt;spListItemEmployee = employeeList.Items.Add();&lt;/P&gt;
&lt;P&gt;But when adding a new item into a Document Library or Picture list, it looks something like the below:&lt;/P&gt;
&lt;P&gt;// Must add the new item to the lists Folder Files collection&amp;nbsp;&lt;BR&gt;file = resumeList.SharePointFolder.Files.Add(xmlNode.InnerText /* Note.doc comes from PS+ ".doc"*/,Convert.FromBase64String(resumeByteStream));&amp;nbsp;&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;BizTalk 2006&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;When BizTalk 2006 ships, it will include a built in out of the box WSS adapter. I am sure there will be improvements to the existing BizTalk 2004 WSS adapter that can be downloaded from GotDotNet. Read more about the new out of the box WSS adapter and other BizTalk 2006 Adapter additions and enhancements &lt;A href="http://blogs.msdn.com/scottwoo/archive/2005/05/19/420139.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.objectsharp.com/blogs/matt/images/SPIntegrationSampleCode.zip"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt; download the sample code that populates&amp;nbsp;a Sharepoint Employee List. Read the Readme.txt before installing and running. &lt;BR&gt;Note: You must have Sharepoint WSS installed and Visual Studio 2003 on a Windows Server 2003 machine in order for the sample to work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=2114" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>BizTalk 2004 -&gt; Enterprise Integration Patterns and BizTalk</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2005/04/17/1826.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2005/04/17/1826.aspx</id><published>2005-04-18T01:14:00Z</published><updated>2005-04-18T01:14:00Z</updated><content type="html">&lt;P&gt;Why use &lt;A href="http://www.enterpriseintegrationpatterns.com"&gt;&lt;STRONG&gt;Patterns&lt;/STRONG&gt;&lt;/A&gt; ?&lt;/P&gt;
&lt;P&gt;1) They help in the design of an Integration Project.&lt;BR&gt;Just like any other type of project, you need a good design in order to successfully develop and implement your solution.&lt;BR&gt;For example: &lt;BR&gt;If you are part of a team building a new ASP.NET application, most likely there will be some design and architecture development for a framework that will support the new ASP.NET application. The same can be said for an integration project, but on a different level.&lt;/P&gt;
&lt;P&gt;Individual patterns can be described by one (Shape) as below.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/PatternsIndividual.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;With an integration project, the&amp;nbsp;goal is to chain the patterns together as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/PatternsNormalizer.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The above diagrams were created in Visio. The Visio template that was used to create the above diagrams &lt;BR&gt;can be downloaded &lt;A href="http://www.enterpriseintegrationpatterns.com/downloads.html"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;The above diagram is NOT a BizTalk specific solution, but really is an Integration (flow) diagram that describes the flow of messages through various system(s) or applications(s).&lt;/P&gt;
&lt;P&gt;How the integration solution is implemented, is really up to the technology or technologies that are available &lt;BR&gt;to the developers. It could be implemented using one or more of the following technologies: &lt;/P&gt;
&lt;P&gt;a) .NET&lt;BR&gt;b) Java &lt;BR&gt;c) a Database such as Sql Server could be used to help in the implementation, &lt;BR&gt;d) MSMQ could be used to help reliably deliver the messages from application to application&lt;BR&gt;e) BizTalk could be used to help carry out the integration. &lt;BR&gt;f) many more tools are available.&lt;/P&gt;
&lt;P&gt;2) Patterns&amp;nbsp;create&amp;nbsp;well designed integration solutions,&amp;nbsp;that&amp;nbsp;produce&lt;BR&gt;implementations that&amp;nbsp;can be&amp;nbsp;easily modified and maintained in the future.&lt;/P&gt;
&lt;P&gt;3) Patterns can help with &lt;A href="http://objectsharp.com/Blogs/matt/archive/2005/04/11/1701.aspx"&gt;&lt;STRONG&gt;Testing&lt;/STRONG&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4) Patterns are simple (for the most part).&lt;/P&gt;
&lt;P&gt;a) Splitter (Splits Messages)&lt;BR&gt;b) Aggregator (Aggregates Messages)&lt;BR&gt;c) Content Enricher (Will add more information or missing information to messages)&lt;BR&gt;d) Normalizer (Normalizes messages into one common format)&lt;BR&gt;e) There are approximately another 60 Patterns.&lt;/P&gt;
&lt;P&gt;The name of the pattern often describes what the pattern does. But there is much to consider in an individual pattern.&lt;BR&gt;For example: &lt;BR&gt;In an Aggregator pattern, what happens if there are ten expected messages to be aggregated , but only nine messages show up?&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;Patterns and BizTalk&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;BizTalk can be used to implement patterns.&lt;BR&gt;For example: If you have worked with BizTalk, you can quickly think of two ways to easily &lt;BR&gt;split a message (a couple are an Envelope or split the message in an orchestration). &lt;/P&gt;
&lt;P&gt;The following features in BizTalk aid in implementing patterns (Note: This is not a complete list) &lt;BR&gt;a) The publish and subscribe model that BizTalk implements.&lt;BR&gt;b) Physical Receive and Send Ports.&lt;BR&gt;c) The correlation features in BizTalk (Correlation Sets, Property Schemas etc).&lt;BR&gt;d) Mapping in BizTalk&lt;BR&gt;e) The Delivery Notification and Ordered Delivery properties in logical ports&lt;BR&gt;g) Role Links and Parties&lt;BR&gt;f) more and more features.&lt;/P&gt;
&lt;P&gt;Not all Patterns are a &lt;A href="http://geekswithblogs.net/asmith/archive/2004/08/13/9669.aspx"&gt;&lt;STRONG&gt;snap&lt;/STRONG&gt;&lt;/A&gt; to build in BizTalk, but&lt;BR&gt;BizTalk does provide a great set of features to implement many of the patterns.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Where to find BizTalk examples of Patterns:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;There are many places to find examples of patterns in BizTalk.&lt;BR&gt;Below are just a few:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.gotdotnet.com/workspaces/workspace.aspx?id=0dfb4f4e-d241-4bc8-8418-2c385d8e3eaa"&gt;&lt;STRONG&gt;Bloggers Guide to BizTalk&lt;/STRONG&gt;&lt;/A&gt;, has a whole section devoted to Patterns in BizTalk&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/scottwoo/archive/2005/01/10/350346.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;My last three Blog entries have discussed some examples of patterns&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=1826" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>BizTalk 2004 -&gt; Aggregator Pattern Using a Map and Orchestration. Also a Content Based Router Pattern</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2005/04/12/1707.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2005/04/12/1707.aspx</id><published>2005-04-12T15:04:00Z</published><updated>2005-04-12T15:04:00Z</updated><content type="html">&lt;P&gt;Below is a method to aggregate many incoming messages into one message using a Map inside of a BizTalk Orchestration.&lt;/P&gt;
&lt;P&gt;This Aggregator pattern is the third demo of a webcast I did on March 28 2005 called: BizTalk Server 2004 Implementing Enterprise Integration Patterns. It can be viewed &lt;A href="https://www118.livemeeting.com/cc/lmevents/view?id=msft032805ad&amp;amp;pw=RWRP4B"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;&amp;nbsp;as a recorded Webcast. The full BizTalk solution can be downloaded at the end of this blog.&lt;/P&gt;
&lt;P&gt;In this particular scenario, the messages split from the &lt;A href="http://objectsharp.com/Blogs/matt/archive/2005/04/12/1703.aspx"&gt;&lt;STRONG&gt;Splitter&lt;/STRONG&gt;&lt;/A&gt; orchestration have been processed by a Production Order application. These processed messages &lt;BR&gt;now have to be aggregated back into one complete message.&lt;/P&gt;
&lt;P&gt;The three abbreviated incoming split messages to be aggregated look something like:&lt;/P&gt;
&lt;P&gt;&amp;lt;Rolls UniqueOrderID="10049" IdMill="Mill_One" OrderCount="3" UniqueIdentifier="7e96e060-3685-48bb-8113-9ae9957d8c4b"&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10003" pro_product_id="10031" sch_prod_order_id="10049"/&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10006" pro_product_id="10022" sch_prod_order_id="10049"/&amp;gt;&amp;nbsp; &amp;nbsp;&lt;BR&gt;&amp;lt;/Rolls&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;Rolls UniqueOrderID="10043" IdMill="Mill_One" OrderCount="3" UniqueIdentifier="7e96e060-3685-48bb-8113-9ae9957d8c4b"&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10004" pro_product_id="10024" sch_prod_order_id="10043"/&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10005" pro_product_id="10022" sch_prod_order_id="10043"/&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10008" pro_product_id="10022" sch_prod_order_id="10043"/&amp;gt; &amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR&gt;&amp;lt;/Rolls&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;Rolls UniqueOrderID="10048" IdMill="Mill_One" OrderCount="3" UniqueIdentifier="7e96e060-3685-48bb-8113-9ae9957d8c4b"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10007" pro_product_id="10022" sch_prod_order_id="10048"/&amp;gt; &amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR&gt;&amp;lt;/Rolls&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;The final aggregated message to construct looks something like :&lt;/P&gt;
&lt;P&gt;&amp;lt;Rolls IdMill="Mill_One"&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10003" pro_product_id="10031" sch_prod_order_id="10049"/&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10006" pro_product_id="10022" sch_prod_order_id="10049"/&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10004" pro_product_id="10024" sch_prod_order_id="10043"/&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10005" pro_product_id="10022" sch_prod_order_id="10043"/&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10008" pro_product_id="10022" sch_prod_order_id="10043"/&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10007" pro_product_id="10022" sch_prod_order_id="10048"/&amp;gt; &amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR&gt;&amp;lt;/Rolls&amp;gt;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;BR&gt;One solution to accomplish the above is discussed below :&lt;/P&gt;
&lt;P&gt;1) Create an Orchestration to accept the incoming messages to be aggregated.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/WebCast1AggregatorOrch.jpg"&gt;&lt;/P&gt;
&lt;P&gt;In the Orchestration:&lt;/P&gt;
&lt;P&gt;a) The first Receive Shape initializes a Correlation Set to aid in the aggregation.&lt;BR&gt;A looping sequential convoy pattern is used in the Orchestration to receive the incoming messages.The first message received by the orchestration is interrogated to determine the expected number of&amp;nbsp; messages to receive. This attribute can be seen on the message such as : OrderCount="3". Therefore in this case loop&lt;BR&gt;three times in the orchestration, because three messages are expected. Another attribute on the first incoming message is also interrogated such as :&amp;nbsp; &lt;BR&gt;UniqueIdentifier="7e96e060-3685-48bb-8113-9ae9957d8c4b". This value will be used to correlate the three incoming messages, into the correct running instance of the same orchestration. After the first message is received, only messages with&amp;nbsp; UniqueIdentifier="7e96e060-3685-48bb-8113-9ae9957d8c4b" will be accepted. If another messages comes in with a different identifier such as :&amp;nbsp; UniqueIdentifier="D9E9DF5E-0071-4ddd-962D-FD4478E4C6FE", then another instance of the Aggregator Orchestration will be created that just accepts messages with that&amp;nbsp;identifier.&lt;BR&gt;Note: The attributes OrderCount and UniqueIdentifier were added to the split messages by the &lt;A href="http://objectsharp.com/Blogs/matt/archive/2005/04/12/1703.aspx"&gt;&lt;STRONG&gt;Splitter&lt;/STRONG&gt;&lt;/A&gt; Orchestration. &lt;/P&gt;
&lt;P&gt;&lt;BR&gt;b) Three messages are declared in the Orchestration:&lt;/P&gt;
&lt;P&gt;i)&amp;nbsp;&amp;nbsp; msgInternalRollsAll&amp;nbsp;(This messages will be the final aggregated message sent out).&amp;nbsp;&lt;BR&gt;ii)&amp;nbsp; msgInternalRollsAllTemp&amp;nbsp;(This message is of the same type as above, but is used to help in processing, discussed below)&lt;BR&gt;iii) msgInternalRollsOneOrderID&amp;nbsp;(This message represents each of the separate incoming messages to be aggregated)&lt;/P&gt;
&lt;P&gt;c) In the orchestration create a valid instance of the msgInternalRollsAll message. This is so the mapping (discussed below) will execute correctly the first time around in the loop.&lt;BR&gt;The below is done inside an expression shape.&lt;/P&gt;
&lt;P&gt;varXMLDomForMsgInternalRolls.LoadXml(@"&amp;lt;ns0:Rolls IdMill=""IdMill_0"" xmlns:ns0=""http://RollsInternal"" /&amp;gt;") ;&lt;BR&gt;construct msgInternalRollsAll&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp; msgInternalRollsAll = varXMLDomForMsgInternalRolls; &lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;d) Use a loop shape. The number of iterations for the loop is controlled by the attribute of the first incoming &lt;BR&gt;message such as : OrderCount="3"&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;e) In the loop, assign the msgInternalRollsAllTemp to the msgInternalRollsAll message.&lt;BR&gt;This is done so we can keep appending to the final output message as each loop executes.&lt;BR&gt;The is accomplished inside an expression shape of the orchestration.&lt;/P&gt;
&lt;P&gt;construct msgInternalRollsAllTemp&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp; msgInternalRollsAllTemp = msgInternalRollsAll;&lt;BR&gt;}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp; &lt;BR&gt;f) In the loop invoke a map that will keep appending to message -&amp;gt; msgInternalRollsAll:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/WebCast1AggregatorMap.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The Destination message for the map is msgInternalRollsAll. A map with two inputs (two xml messages) is used to create the output message.&lt;BR&gt;The first source for the map is the msgInternalRollsOneOrderID message that contains the contents&amp;nbsp; of each incoming split message to be appended to the&amp;nbsp;final outgoing message&amp;nbsp;&amp;nbsp; -&amp;gt; msgInternalRollsAll. The second source to the map is the msgInternalRollsAllTemp message. This is an interim message that&amp;nbsp;is used to keep a copy of the final output message (msgInternalRollsAll) for each iteration of the loop. The map will then take the contents of two messages (nodes) and combine them into one node.&lt;BR&gt;A looping functoid is used to combine the contents of two nodes into the final source node.&lt;BR&gt;A more detailed explanation of this method can be found &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_prog_map_nvsc.asp"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;.&lt;BR&gt;&amp;nbsp;&lt;BR&gt;g) Use a decide shape to determine if more messages are expected.&lt;BR&gt;If more messages are expected, use a receive shape to receive the next incoming split message, then go to the top of the loop to append this split message to the final output message. If no more messages are expected then the final output message (msgInternalRollsAll) is sent to the &lt;BR&gt;correct destination using a Content Based Router Pattern as below.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;Content Based Router Pattern&lt;/STRONG&gt;&lt;BR&gt;----------------------------------&lt;/P&gt;
&lt;P&gt;Initially a message came into the system from a particular Party. In the demo, messages can be received from three different parties : Mill One, Mill Two, Mill Three.&lt;BR&gt;These messages were then Normalized, Split, Aggregated and now the final message must be routed back to the Mill that originally sent the message. Therefore the outgoing message contains some information about where it is going. In this case there is a attribute in the outgoing message such as :&lt;BR&gt;IdMill="Mill_One". This value in the attribute will be used to dynamically route the message to the correct party. Therefore to implement this in a BizTalk Solution, Role Links in an Orchestration and Parties created in BizTalk&amp;nbsp;Explorer were used. In the orchestration the following code in a expression shape is used to route the &lt;BR&gt;message to the correct party:&lt;/P&gt;
&lt;P&gt;varStrMillToSendTo = msgInternalRollsAll.IdMill;&lt;BR&gt;RoleLinkToCorrectMill(Microsoft.XLANGs.BaseTypes.DestinationParty) = new Microsoft.XLANGs.BaseTypes.Party(varStrMillToSendTo, "OrganizationName");&lt;/P&gt;
&lt;P&gt;If you have not used Role Links and Parties before, go to &lt;A href="http://geekswithblogs.net/toddu/archive/2004/09/28/11798.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt; and &lt;A href="http://geekswithblogs.net/toddu/archive/2004/10/05/12156.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt; for a more detailed explanation.&lt;BR&gt;&lt;BR&gt;Again the full sample can be downloaded &lt;A href="http://www.objectsharp.com/blogs/matt/images/BizTalk 2004 WebCast.zip"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;&amp;nbsp;. Read the ReadMe.txt file in the zip file, before unzipping and installing.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;More Aggregator Patterns&lt;BR&gt;&lt;/STRONG&gt;------------------------------&lt;/P&gt;
&lt;P&gt;Note: There are multiple ways to implement an Aggregator Pattern in BizTalk.&lt;BR&gt;Another method includes using XML Document type .Net objects to build up the message in the orchestration:&lt;BR&gt;Please see &lt;A href="http://geekswithblogs.com/asmith/articles/9778.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt; and &lt;A href="http://objectsharp.com/Blogs/matt/archive/2004/11/09/1009.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt; for other examples.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=1707" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>BizTalk 2004 -&gt; Splitter Pattern Using a Map and Orchestration.</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2005/04/12/1703.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2005/04/12/1703.aspx</id><published>2005-04-12T13:05:00Z</published><updated>2005-04-12T13:05:00Z</updated><content type="html">&lt;P&gt;Below is a method to Split one message into multiple messages using a Map inside of a BizTalk Orchestration.&lt;/P&gt;
&lt;P&gt;This Splitter pattern is the second demo of a webcast I did on March 28 2005 &lt;BR&gt;called: BizTalk Server 2004 Implementing Enterprise Integration Patterns. It can be viewed &lt;A href="https://www118.livemeeting.com/cc/lmevents/view?id=msft032805ad&amp;amp;pw=RWRP4B"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;&lt;BR&gt;as a recorded Webcast. The full BizTalk solution can be downloaded at the end of this blog.&lt;/P&gt;
&lt;P&gt;In this particular scenario, an Incoming message contains several production orders.&lt;BR&gt;This message was created from a Normalizer(this is a pattern) Orchestration. A discussion &lt;BR&gt;of the Normalizer Pattern can be found &lt;A href="http://objectsharp.com/Blogs/matt/archive/2005/04/11/1701.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;The abbreviated incoming Normalized XML message looks something like the below:&lt;/P&gt;
&lt;P&gt;&amp;lt;Rolls&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10003" pro_product_id="10031" sch_prod_order_id="10049"/&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10004" pro_product_id="10024" sch_prod_order_id="10043"/&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10005" pro_product_id="10022" sch_prod_order_id="10043"/&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10006" pro_product_id="10022" sch_prod_order_id="10049"/&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10007" pro_product_id="10022" sch_prod_order_id="10048"/&amp;gt; &amp;nbsp;&lt;BR&gt;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10008" pro_product_id="10022" sch_prod_order_id="10043"/&amp;gt; &amp;nbsp;&lt;BR&gt;&amp;lt;/Rolls&amp;gt;&lt;/P&gt;
&lt;P&gt;From the above message there are three distinct Order Ids:&lt;/P&gt;
&lt;P&gt;10049&lt;BR&gt;10043&lt;BR&gt;10048&lt;/P&gt;
&lt;P&gt;Therefore the goal is to split the incoming Normalized message into three separate messages, &lt;BR&gt;each with their own unique Order Id and respective line items as below:&lt;/P&gt;
&lt;P&gt;Message one:&lt;/P&gt;
&lt;P&gt;&amp;lt;Rolls UniqueOrderID=10049&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10003" pro_product_id="10031" sch_prod_order_id="10049"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10006" pro_product_id="10022" sch_prod_order_id="10049"/&amp;gt;&amp;nbsp; &amp;nbsp;&lt;BR&gt;&amp;lt;/Rolls&amp;gt;&lt;/P&gt;
&lt;P&gt;Message two:&lt;/P&gt;
&lt;P&gt;&amp;lt;Rolls UniqueOrderID=10043&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10004" pro_product_id="10024" sch_prod_order_id="10043"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10005" pro_product_id="10022" sch_prod_order_id="10043"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10008" pro_product_id="10022" sch_prod_order_id="10043"/&amp;gt; &amp;nbsp;&lt;BR&gt;&amp;lt;/Rolls&amp;gt;&lt;/P&gt;
&lt;P&gt;Message three:&lt;/P&gt;
&lt;P&gt;&amp;lt;Rolls UniqueOrderID=10048&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10007" pro_product_id="10022" sch_prod_order_id="10048"/&amp;gt; &amp;nbsp;&lt;BR&gt;&amp;lt;/Rolls&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;One solution to accomplish the above is discussed below :&lt;/P&gt;
&lt;P&gt;1) Create an Orchestration to accept the incoming message and split it out into &lt;BR&gt;separate messages: &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/WebCast1SplitterOrch.jpg"&gt;&lt;/P&gt;
&lt;P&gt;In the Orchestration:&lt;/P&gt;
&lt;P&gt;a) Find the distinct list of Order Ids in the message. One method to do this is to utilize some custom &lt;BR&gt;XSLT in a BizTalk map as below :&lt;/P&gt;
&lt;P&gt;&amp;lt;xsl:key name="Code-types" match="trk_unit_roll_ageable" use="@sch_prod_order_id"/&amp;gt;&lt;BR&gt;&amp;lt;xsl:template match="/"&amp;gt;&lt;BR&gt;&amp;lt;ns0:Rolls xmlns:ns0="http://ObjectSharp"&amp;gt;&lt;BR&gt;&amp;lt;xsl:for-each select="//trk_unit_roll_ageable[count(.| key('Code-types', @sch_prod_order_id)[1]) = 1]"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;xsl:element name="ProdOrderIds"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:attribute name="sch_prod_order_id"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:value-of select="@sch_prod_order_id"/&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;lt;/xsl:attribute&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;/xsl:element&amp;gt;&lt;BR&gt;&amp;lt;/xsl:for-each&amp;gt;&lt;BR&gt;&amp;lt;/ns0:Rolls&amp;gt;&lt;BR&gt;&amp;lt;/xsl:template&amp;gt;&lt;/P&gt;
&lt;P&gt;This XSLT can be used in a map. A method to include custom XSLT in a map is discussed in more detail &lt;A href="http://objectsharp.com/Blogs/matt/archive/2004/11/24/1031.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;The final constructed message (msgDistinctOrdersIds) contains a list of distinct order ids:&lt;/P&gt;
&lt;P&gt;&amp;lt;Rolls&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;ProdOrderIds sch_prod_order_id="10049"/&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;ProdOrderIds sch_prod_order_id="10043"/&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;ProdOrderIds sch_prod_order_id="10048"/&amp;gt; &lt;BR&gt;&amp;lt;/Rolls&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;b) Use an xpath statement to find a count of Distinct Order Ids.&lt;BR&gt;In this case an xpath statement is used in the orchestration as below:&lt;/P&gt;
&lt;P&gt;xpath(msgDistinctOrdersIds,"number(count(/*[local-name()='Rolls' and&amp;nbsp; namespace-uri()='http://ObjectSharp']/*[local-name()='ProdOrderIds' and namespace-uri()='']))");&lt;/P&gt;
&lt;P&gt;In the above example the xpath statement will return a value of three.&lt;/P&gt;
&lt;P&gt;c) To create each separate message, a loop shape is used in the orchestration. The number of times to iterate in the loop is the value returned from the &lt;BR&gt;xpath statement of step b).&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;d) For each iteration in the loop shape:&lt;BR&gt;i) Use an xpath statement to find the current distinct Order Id in the iteration as below:&lt;BR&gt;&amp;nbsp;&amp;nbsp; varIntSchProdOrderId = xpath(msgDistinctOrdersIds,"number(//ProdOrderIds[" + varStrOrderCounter + "]//@sch_prod_order_id)"); &lt;BR&gt;&amp;nbsp;&amp;nbsp; The message used in the xpath statement is the message created in step a). This is a message with the&amp;nbsp;distinct order ids.&lt;BR&gt;ii)Construct a helper XML message (msgSplitterParameters) that will be used in the map to aid in the splitting.&lt;BR&gt;&amp;nbsp;&amp;nbsp; In this case this message will contain the unique Order Id of the current iteration. An expression &lt;BR&gt;&amp;nbsp;&amp;nbsp; shape with the following code is used to create a brand new version of the message in each iteration of the loop.&lt;BR&gt;&amp;nbsp; &lt;BR&gt;varXMLDomSplittingParametersMsg.LoadXml(@"&amp;lt;ns0:SplitterParameters ProdOrderID=""0"" OrderCount=""0"" UniqueIdentifier=""""&amp;nbsp; xmlns:ns0=""http://ObjectSharp"" /&amp;gt;");&lt;/P&gt;
&lt;P&gt;construct msgSplitterParameters&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp; msgSplitterParameters = varXMLDomForSplittingParametersMsg;&lt;BR&gt;&amp;nbsp;&amp;nbsp; msgSplitterParameters.ProdOrderID = varIntSchProdOrderId;&lt;BR&gt;&amp;nbsp;&amp;nbsp; msgSplitterParameters.OrderCount = varIntTotalNumberOfDistinctOrders;&lt;BR&gt;&amp;nbsp;&amp;nbsp; msgSplitterParameters.UniqueIdentifier = varStrUniqueIdentifier;&lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;Note: A discussion of how to construct messages in an orchestration is &lt;A href="http://objectsharp.com/Blogs/matt/archive/2004/11/09/1009.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;e) For each iteration of the loop, Use a map in the orchestration and use the original input message to create a (split)&amp;nbsp; &lt;BR&gt;message with that unique order id:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/WebCast1SplitterMap.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;A map with two inputs (two xml messages) is used to create the final output message. The first source used in the map is the original input message with all order items. &lt;BR&gt;The second source is the parameter message constructed in part d). The whole trick of this&amp;nbsp;implementation is to change this parameter message through each iteration of the loop.&lt;BR&gt;Each iteration will produce the correct split message.&lt;/P&gt;
&lt;P&gt;The map is quite simple. The first input is the original input message to create each split message&amp;nbsp; with one unique order id. The second message (parameter message) is used to help filter out the unique line items with that order id in the first input of the map. A logical Equal functoid in the map is used to do the actual filtering. &lt;/P&gt;
&lt;P&gt;For example for the first iteration of the loop in the above example, one of the values in the &lt;BR&gt;parameter message is set to:&lt;/P&gt;
&lt;P&gt;msgSplitterParameters.ProdOrderID = "10049"&lt;/P&gt;
&lt;P&gt;Then when the map is invoked in the loop, the following split message will be produced :&lt;/P&gt;
&lt;P&gt;&amp;lt;Rolls UniqueOrderID=10049&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10003" pro_product_id="10031" sch_prod_order_id="10049"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;trk_unit_roll_ageable trk_unit_id="10006" pro_product_id="10022" sch_prod_order_id="10049"/&amp;gt;&amp;nbsp; &amp;nbsp;&lt;BR&gt;&amp;lt;/Rolls&amp;gt;&lt;/P&gt;
&lt;P&gt;Again the full sample can be downloaded &lt;A href="http://www.objectsharp.com/blogs/matt/images/BizTalk 2004 WebCast.zip"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt; &lt;BR&gt;Read the ReadMe.txt file in the zip file, before unzipping and installing.&lt;/P&gt;
&lt;P&gt;Note: That the solution also contains a Normalizer Orchestration and &lt;BR&gt;Aggregator Orchestration that are discussed in other blog entries.&lt;/P&gt;
&lt;P&gt;Note: Many methods exist to split messages in BizTalk,&lt;BR&gt;such as using Envelopes, Custom XSLT, XPATH, etc.&lt;BR&gt;Please check out some of the other methods &lt;A href="http://blogs.msdn.com/darrenj/archive/2004/08/30/222614.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt; , &lt;A href="http://codebetter.com/blogs/jeff.lynch/archive/2005/03/06/56590.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;, &lt;A href="http://geekswithblogs.net/sthomas/archive/2004/12/12/17373.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;, &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/operations/htm/ebiz_prog_adapt_ynaa.asp"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=1703" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>BizTalk 2004 -&gt; Testing Orchestrations using Nunit, Submit BizTalk Adapter and a Normalizer Pattern</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2005/04/11/1701.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2005/04/11/1701.aspx</id><published>2005-04-12T00:47:00Z</published><updated>2005-04-12T00:47:00Z</updated><content type="html">&lt;P&gt;To create a Nunit test of a single orchestration or a series of orchestrations is not a natural process. &lt;BR&gt;I came up with this method for testing Orchestrations using Nunit when I was working on a BizTalk project. The client required that Nunit tests be performed on the orchestrations that were developed. It is also part of the first demo of a WebCast I did on March 28 2005 called: BizTalk Server 2004 Implementing Enterprise Integration Patterns. It can be viewed &lt;A href="https://www118.livemeeting.com/cc/lmevents/view?id=msft032805ad&amp;pw=RWRP4B"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;&lt;STRONG&gt; &lt;/STRONG&gt;as a recorded Webcast. &lt;BR&gt;In the below example a Normalizer pattern Orchestration is being tested. The full BizTalk solution can be downloaded at the end of this blog.&lt;BR&gt;The below details are somewhat involved, but if you download the above solution and install, analyze and run the BizTalk demos, it will become clear.&lt;/P&gt;
&lt;P&gt;Getting back to the project. I was applying &lt;A href="http://www.enterpriseintegrationpatterns.com"&gt;&lt;STRONG&gt;Patterns&lt;/STRONG&gt;&lt;/A&gt; to this particular integration solution. This in turned produced a more modular type of solution with a Normalizer (this is a pattern) Orchestration and a Message Aggregator (this is another pattern) Orchestration. Because the solution was more modular in nature, it also made it easier to test. Additionally this method uses a Test harness Orchestration to asynchronously call the Normalizer Orchestration. In the production environment the test harness Orchestration would be replaced by another orchestration. &lt;/P&gt;
&lt;P&gt;This testing method will not work for every type of Orchestration scenario, but works best if the Orchestration is modular in nature (i.e. implements some pattern). Even if you do not use this method for testing Orchestrations, this example shows:&lt;BR&gt;1) A Nomalizer Pattern (two different BizTalk implementations are discussed).&lt;BR&gt;2) How to pass multi-part messages between orchestrations.&lt;BR&gt;3) How to conditionally turn an asynchronous call to another orchestration into a Synchronous Call.&lt;/P&gt;
&lt;P&gt;The basic flow to test the Normalizer Orchestration is to:&lt;BR&gt;1) Use .NET code in a Nunit Test Harness to produce a XML message that will ultimately be passed to the Normalizer Orchestration.&lt;BR&gt;2) The .NET Code then calls the BizTalkMessaging.SubmitSyncMessage method to submit the XML message&lt;BR&gt;to a Request-Response Receive Physical Port that uses the Submit Adapter. Because the SubmitSyncMessage method is used, the code will then wait for a response back from the Receive Port. &lt;BR&gt;3) The Receive Port then publishes the incoming message from the Nunit test harness into BizTalk.&lt;BR&gt;4) A Test harness Orchestration then subscribes to the message published by the Submit Adapter. This Orchestration will then use the Start Shape and asynchronously call the Normalizer Orchestration passing a couple of parameters, one containing the XML message for the Normalizer to work on and the other &lt;BR&gt;being a Self Correlated Port.&lt;BR&gt;5) The Normalizer Orchestration will then process the message and then construct a multipart message to be sent back to the Test Harness Orchestration. The Normalizer Orchestration will then call back to the Test Harness Orchestration using the Self Correlated Port passed in as a parameter.&lt;BR&gt;6) The Test Harness Orchestration then constructs a response message using the results from the Normalizer Orchestration. This message is then passed back to the Nunit test harness code, using the the Logical Request-Response logical port in the Test Harness Orchestration.&lt;BR&gt;7) The Request-Response Receive Physical Port described in 2) will then send the response message back to the .NET Nunit Test Harness code via the BizTalkMessaging.SubmitSyncMessage call.&lt;BR&gt;8) The .NET code in the Nunit Test Harness can then interrogate the message sent back, and perform some tests on this message.&lt;/P&gt;
&lt;P&gt;Therefore the important pieces to this are:&lt;BR&gt;1) .Net code in the Nunit Test Harness&lt;BR&gt;2) The Submit Direct Adapter &lt;BR&gt;3) A Test Harness Orchestration. In a production environment, this orchestration would be replaced by another orchestration that will call the Actual Orchestration to be tested as in 4). &lt;BR&gt;4) The Actual Orchestration being tested, in this case the Normalizer Orchestration.&lt;/P&gt;
&lt;P&gt;To go into more detail:&lt;/P&gt;
&lt;P&gt;1) In a Nunit test harness, submit a message &lt;BR&gt;to BizTalk. (Note: this is not the full code)&lt;/P&gt;
&lt;P&gt;string submitURI = "submit://MessageNormalizer";&lt;BR&gt;btm = new BizTalkMessaging();&lt;BR&gt;System.Xml.XmlDocument xmlDomRollsFromMillOne = New System.Xml.XmlDocument(); &lt;BR&gt;xmlDomRollsFromMillOne.LoadXML(@"c:\somexml.xml")&lt;BR&gt;IBaseMessage responseMsg = null;&lt;BR&gt;responseMsg = btm.SubmitSyncMessage(btm.CreateMessageFromString(submitURI,xmlDomRollsFromMillOne.OuterXml));&lt;BR&gt;// Note: Because using the SubmitSyncMessage method, this code will now wait for the response message coming back.&lt;/P&gt;
&lt;P&gt;Note:&lt;BR&gt;Nunit 2.2.0, can be downloaded &lt;A href="http://www.nunit.org/download.html"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Note: &lt;BR&gt;SubmitDirect BizTalk adapter can be installed by running -&gt;&lt;BR&gt;C:\Program Files\Microsoft BizTalk Server 2004\SDK\Samples\Adapters\SubmitDirect\Setup.bat&lt;BR&gt;Also read about the SubmitDirect Adapter sample &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_sdk_samples_bgip.asp"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt; &lt;/A&gt;&lt;/P&gt;
&lt;P&gt;For users of BizTalk 2000 and BizTalk 2002, the SubmitDirect adapter replaces the BizTalk 2000 and 2002 API calls Submit and SubmitSync. The SubmitDirect Adapter allows the submittal of messages to BizTalk Server programmatically. Therefore you can write some C# or VB.Net code that can submit a message to BizTalk server and optionally receive back a response.&lt;/P&gt;
&lt;P&gt;2) Create a Request-Response Receive Physical Port that uses the Submit Adapter as below:&lt;/P&gt;
&lt;P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/WebCast1NormalizerSubmitReceivePort.jpg"&gt;&lt;/P&gt;
&lt;P&gt;3) Create some common orchestration types to help in the testing:&lt;/P&gt;
&lt;P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/WebCast1NormalizerOrcTypes.jpg"&gt;&lt;/P&gt;
&lt;P&gt;a) Multi-part Message Type: mpMsgTypeRolls &lt;BR&gt;(This multipart is used to pass information to the Normalizer Orchestration)&lt;BR&gt;mpMsgTypeRolls contains Message Parts:&lt;BR&gt;i) msgCallBackToOrchestrationFlag. This flag is set to "1" if the Normalizer Orchestration is to call back&lt;BR&gt;to the calling Orchestration. Therefore in the development/testing environment this flag is set to "1".&lt;BR&gt;In the production environment this flag is set to "0". This is so I can use the Normalizer Orchestration &lt;BR&gt;in the production environment without modifying anything and just changing the passed flag to "0"&lt;BR&gt;ii) msgXMLRolls. This is a string of XML that contains the Roll Production Orders.&lt;/P&gt;
&lt;P&gt;b) Multi-part Message Type: mpMsgTypeTestHarnessResults&lt;BR&gt;(This multipart is used to pass information from the Normalizer Orchestration back to the test harness orchestration.)&lt;BR&gt;mpMsgTypeTestHarnessResults contains Message Parts:&lt;BR&gt;i)   msgErrorMessage. This is a string that will be set with any error message.&lt;BR&gt;ii)  msgNumberOfRollsSplit. This is populated by Message Splitter Orchestration&lt;BR&gt;iii) msgXmlRolls. This is returned with the mapped normalized message.&lt;/P&gt;
&lt;P&gt;c) Multi-part Message Type: mpMsgTypeInvalidMessage&lt;BR&gt;(This multipart is used to pass information from the Normalizer Orchestration, to the Invalid Message Orchestration.&lt;BR&gt;mpMsgTypeTestHarnessResults contains Message Parts:&lt;BR&gt;i) msgInvalidXMLMessage. This contains the invalid xml that the Normalizer Orchestration cannot parse.&lt;/P&gt;
&lt;P&gt;d) Port Type: PortTypeTestHarnessResults&lt;BR&gt;This port type is used to create a port that will be passed as a parameter into the Normalizer Orchestration. &lt;BR&gt;The Normalizer Orchestration will then call back on this port to the calling orchestration.&lt;/P&gt;
&lt;P&gt;4) The test harness orchestration then receives the message from the Nunit test harness via the Submit Receive Port, and then in turn calls the Normalizer Orchestration with the following parameters:&lt;BR&gt;i) mpMsgRollsRequest. This multipart message is populated with the XML message to normalize and a flag to &lt;BR&gt;indicate to call back to this particular orchestration.&lt;BR&gt;ii) PortReceiveBackTestHarnessResults. Port of type PortTypeTestHarnessResults. This is a Direct - Self Correlating Port.&lt;/P&gt;
&lt;P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/WebCast1NormalizerCorrelationPort.jpg"&gt;&lt;/P&gt;&lt;BR&gt;The Normalizer Orchestration can then call back to the test harness orchestration even though the &lt;BR&gt;test harness orchestration called the Normalizer Orchestration asynchronously. A good discussion of Direct &lt;BR&gt;Port Binding Types can be found &lt;A href="http://geekswithblogs.net/cyoung/archive/2005/01/10/19547.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;  
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;5) The Normalizer Orchestration then receives the information from passed parameters and &lt;BR&gt;then Normalizes the message. Because an untyped message is passed to this orchestration, it must first determine the map to invoke. Therefore a property on the message is interrogated to determine the type of message : &lt;BR&gt;varStrMessageType = msgIncomingRolls(BTS.MessageType);&lt;BR&gt;varStrMessageType is then populated with the correct message type such as -&gt; http://RollsFromMillOne#Rolls.&lt;BR&gt;This is of course the TargetNameSpace#RootNodeName combination of the incoming message. A decision shape in this orchestration will then decide what map will be used to Normalize the message based on the contents of the Message Type. If the message is unrecognized, then the InValid MessageChannel Orchestration is called. (This is another pattern).&lt;/P&gt;
&lt;P&gt;6) Once the Normalized message has been processed, the Test Harness Orchestration is called back from the Normalizer Orchestration using the port PortCallBackResults that was passed as a parameter by the calling test harness orchestration. This is how an asynchronous call can be conditionally turned into a synchronous call.&lt;/P&gt;
&lt;P&gt;7) The Test Harness Orchestration then calls back to the to the Submit Direct Test harness code in 1).This code, can then perform tests on the results sent back.&lt;/P&gt;
&lt;P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/WebCast1NormalizerNunitTestGui.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;For a comprehensive Nunit Test Framework please go &lt;A href="http://blogs.msdn.com/kevinsmi/archive/2004/09/18/231259.aspx"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;Another Normalizer Pattern&lt;BR&gt;&lt;/STRONG&gt;-------------------------------&lt;/P&gt;
&lt;P&gt;A much simpler method to create a Normalizer pattern in BizTalk is by specifying a Set of Maps in &lt;BR&gt;a Physical Receive Port or Physical Send Port as below:&lt;/P&gt;
&lt;P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/WebCast1NormalizerInPort.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Depending on message type of the incoming message, one of the following maps will be invoked&lt;BR&gt;producing the normalized message:&lt;/P&gt;
&lt;TABLE id=Table1 height=99 cellSpacing=1 cellPadding=1 width=656 border=1&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width=221 height=23&gt;&lt;STRONG&gt;MessageType&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD height=23&gt;&lt;STRONG&gt;Map Invoked&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width=221&gt;http://RollsFromMillOne#Rolls&lt;/TD&gt;
&lt;TD&gt;Map_RollsFromMillOne_To_RollsInternal.btm&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width=221&gt;http://RollsFromMillTwo#Rolls&lt;/TD&gt;
&lt;TD&gt;Map_RollsFromMillTwo_To_RollsInternal.btm&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width=221&gt;http://RollsFromMillThree#Rolls&lt;/TD&gt;
&lt;TD&gt;Map_RollsFromMillThree_To_RollsInternal.btm&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;&lt;BR&gt;In the above scenario, no orchestrations are required and all the necessary mapping can be &lt;BR&gt;accomplished in Physical Receive or Send Ports&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Again the full sample can be downloaded &lt;STRONG&gt;&lt;A href="http://www.objectsharp.com/blogs/matt/images/BizTalk 2004 WebCast.zip"&gt;HERE&lt;/A&gt;.&lt;/STRONG&gt; To install and run, Read the ReadMe.txt file in the zip file, before unzipping and installing. Also included with the sample are a Splitter Pattern Orchestration and an Aggregator Pattern Orchestration that will be discussed in future blog entries.&lt;BR&gt; &lt;/P&gt;
&lt;P&gt; &lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=1701" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>BizTalk Server 2004 and Sql Server 2000 -&gt; XML Auto and XML Explicit</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2005/03/22/1560.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2005/03/22/1560.aspx</id><published>2005-03-23T03:20:00Z</published><updated>2005-03-23T03:20:00Z</updated><content type="html">&lt;P&gt;BizTalk 2004 provides support for processing XML documents returned from Sql Server&lt;BR&gt;via the Sql Adapter that ships with BizTalk Server 2004.&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;P&gt;Select * &lt;BR&gt;From Customers&lt;BR&gt;For XML Auto&lt;/P&gt;
&lt;P&gt;will produce an XML document that can be processed by BizTalk 2004 received via the Sql Receive Adapter.&lt;/P&gt;
&lt;P&gt;The BizTalk documentation states that only the XML Auto clause is supported and &lt;BR&gt;not the XML Explicit clause. But in fact BizTalk can process Sql Server XML documents that &lt;BR&gt;are generated using the XML Explicit clause (this will be explained below).&lt;/P&gt;
&lt;P&gt;If you have not used the Sql Adapter before, try the following two examples in the BizTalk SDK:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/operations/htm/ebiz_prog_adapt_tbdk.asp"&gt;Using the SQL Adapter with a Stored Procedure in an Orchestration&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_sdk_samples_adapters_pivl.asp"&gt;SQL Adapter (BizTalk Server Sample)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;For BizTalk to interact with an XML document originating from Sql Server, &lt;BR&gt;one of the first steps is to create a xsd schema that describes the &lt;BR&gt;XML returned from a Select statement.&lt;BR&gt;This xsd schema can be automatically generated in a BizTalk project by Adding a Generated Item, as outlined&lt;BR&gt;&lt;A href=" http://msdn.microsoft.com/library/default.asp?url=/library/en-us/operations/htm/ebiz_prog_adapt_tbdk.asp"&gt;HERE&amp;nbsp;&lt;/A&gt;&amp;nbsp;This is only if the Select statement has an XML Auto clause (and XMLData clause, that is removed after the &lt;BR&gt;schema is generated). If a Select Statement with a XML Explicit clause is used to generate the &lt;BR&gt;schema, the xsd schema generation will fail with an error such as : The required attribute 'name' is missing.&lt;BR&gt;An error occurred at , (0,0). Or : Failed to execute sql Statement. Please ensure that the supplied syntax is correct. &lt;/P&gt;
&lt;P&gt;This is possibly why the BizTalk documentation states that the XML Explicit is not supported.&lt;BR&gt;But again, BizTalk can use XML returned by XML Explicit (explained below).&lt;/P&gt;
&lt;P&gt;So why use the XML Explicit clause over the XML Auto clause? Simply because the XML Explicit clause &lt;BR&gt;gives you much more control of the XML structure that is returned by Sql Server compared to &lt;BR&gt;the XML Auto clause.&lt;/P&gt;
&lt;P&gt;For example, an Order is associated with a Shipper, Customer and Order Items.&amp;nbsp; &lt;BR&gt;The following Select Statement using XML Auto:&lt;/P&gt;
&lt;P&gt;Select&amp;nbsp;[Order].OrderID, &lt;BR&gt;&amp;nbsp;Shipper.ShipperID as ShipperID, &amp;nbsp;&lt;BR&gt;&amp;nbsp;Shipper.CompanyName As ShipperName,&lt;BR&gt;&amp;nbsp;Customer.CompanyName as CustomerName,&lt;BR&gt;&amp;nbsp;OrderDetails.Quantity as Quantity,&lt;BR&gt;&amp;nbsp;OrderDetails.UnitPrice as UnitPrice,&lt;BR&gt;&amp;nbsp;OrderDetails.ProductID as ProductId&amp;nbsp;&amp;nbsp;&lt;BR&gt;From Orders as [Order] &lt;BR&gt;&amp;nbsp;Join Shippers as Shipper &lt;BR&gt;&amp;nbsp;On [Order].ShipVia = Shipper.ShipperID&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Join Customers as Customer&lt;BR&gt;&amp;nbsp; &amp;nbsp;On [Order].CustomerID = Customer.CustomerID&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Join [Order Details] as OrderDetails&lt;BR&gt;&amp;nbsp;On [Order].OrderID = OrderDetails.OrderID&amp;nbsp;&lt;BR&gt;For Xml Auto&lt;/P&gt;
&lt;P&gt;Will return XML in the format of: &lt;/P&gt;
&lt;P&gt;&lt;ORDERS&gt;&lt;BR&gt;&amp;lt;Orders&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;Order OrderID="11077"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;lt;Shipper ShipperID="2" ShipperName="United Package"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;Customer CustomerName="Rattlesnake Canyon Grocery"&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;OrderDetails Quantity="24" UnitPrice="19.0000" ProductId="2" /&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;OrderDetails Quantity="4" UnitPrice="10.0000" ProductId="3" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/Customer&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;lt;/Shipper&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;/Order&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;Order OrderID="11076"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;lt;Shipper ShipperID="2" ShipperName="United Package"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;Customer CustomerName="Bon app'"&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;OrderDetails Quantity="20" UnitPrice="25.0000" ProductId="6" /&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;OrderDetails Quantity="20" UnitPrice="23.2500" ProductId="14" /&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;OrderDetails Quantity="10" UnitPrice="9.2000" ProductId="19" /&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/Customer&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;lt;/Shipper&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;/Order&amp;gt;&lt;BR&gt;&amp;lt;/Orders&amp;gt;&lt;BR&gt;&amp;nbsp;&lt;ORDER OrderID="11077"&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;Note: That the top level parent node Orders is added by the Sql Adapter&lt;/P&gt;
&lt;P&gt;The above format is not desired because the parent node &lt;BR&gt;of the Customer node is the Shipper node and the parent node of the &lt;BR&gt;OrderDetails is the Customer node. In this case the desired format of the &lt;BR&gt;XML message will have the Order Node being the parent node of the &lt;BR&gt;Shipper, Customer and OrderDetails nodes as below:&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;ORDERS&gt;&amp;lt;Orders&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;lt;Order OrderID="11077"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Shipper ShipperID="2" ShipperName="United Package"&amp;gt;&amp;lt;/Shipper&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Customer CustomerName="Rattlesnake Canyon Grocery"&amp;gt;&amp;lt;/Customer&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderDetails&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderDetail Quantity="24" UnitPrice="19.0000" ProductId="2" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderDetail Quantity="4" UnitPrice="10.0000" ProductId="3" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;lt;/OrderDetails&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;lt;/Order&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;Order OrderID="11076"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Shipper ShipperID="2" ShipperName="United Package"&amp;gt;&amp;lt;/Shipper&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Customer CustomerName="Bon app"&amp;gt;&amp;lt;/Customer&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderDetails&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderDetail Quantity="20" UnitPrice="25.0000" ProductId="6" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderDetail Quantity="20" UnitPrice="23.2500" ProductId="14" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderDetail Quantity="10" UnitPrice="9.2000" ProductId="19" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/OrderDetails&amp;gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;lt;/Order&amp;gt;&lt;BR&gt;&amp;lt;/Orders&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;To return the XML in this (above) format, the below Select statement with a XML Explicit clause is used:&lt;/P&gt;
&lt;P&gt;SELECT&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; as Tag, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;NULL&amp;nbsp; as Parent,&lt;BR&gt;&amp;nbsp;Orders.OrderID as [Order!1!OrderId],&lt;BR&gt;&amp;nbsp;Null as [Shipper!2!ShipperID],&lt;BR&gt;&amp;nbsp;Null as [Shipper!2!ShipperName],&lt;BR&gt;&amp;nbsp;Null as [Customer!3!CustomerName],&lt;BR&gt;&amp;nbsp;Null as [OrderDetails!4!OrderId!hide],&lt;BR&gt;&amp;nbsp;Null as [OrderDetail!5!Quantity],&lt;BR&gt;&amp;nbsp;Null as [OrderDetail!5!UnitPrice],&lt;BR&gt;&amp;nbsp;Null as [OrderDetail!5!ProductId]&lt;BR&gt;From Orders&lt;BR&gt;&amp;nbsp;Join #OrdersToGet&lt;BR&gt;&amp;nbsp;On #OrdersToGet.OrderID = Orders.OrderID&lt;BR&gt;Union All&lt;BR&gt;Select &amp;nbsp;2,&lt;BR&gt;&amp;nbsp;1,&lt;BR&gt;&amp;nbsp;#OrdersToGet.OrderID,&lt;BR&gt;&amp;nbsp;Shippers.ShipperID,&lt;BR&gt;&amp;nbsp;Shippers.CompanyName,&lt;BR&gt;&amp;nbsp;Null,&lt;BR&gt;&amp;nbsp;Null,&lt;BR&gt;&amp;nbsp;Null,&lt;BR&gt;&amp;nbsp;Null,&lt;BR&gt;&amp;nbsp;Null&lt;BR&gt;From Shippers&lt;BR&gt;&amp;nbsp;Join #OrdersToGet&lt;BR&gt;&amp;nbsp;On #OrdersToGet.ShipVia = Shippers.ShipperID&lt;BR&gt;Union All&lt;BR&gt;Select &amp;nbsp;3,&lt;BR&gt;&amp;nbsp;1,&lt;BR&gt;&amp;nbsp;#OrdersToGet.OrderID,&lt;BR&gt;&amp;nbsp;Null,&lt;BR&gt;&amp;nbsp;Null,&lt;BR&gt;&amp;nbsp;Customers.CompanyName,&lt;BR&gt;&amp;nbsp;Null,&lt;BR&gt;&amp;nbsp;Null,&lt;BR&gt;&amp;nbsp;Null,&lt;BR&gt;&amp;nbsp;Null&lt;BR&gt;From Customers&lt;BR&gt;&amp;nbsp;Join #OrdersToGet&lt;BR&gt;&amp;nbsp;On #OrdersToGet.CustomerID = Customers.CustomerID&lt;BR&gt;Union All&lt;BR&gt;Select &amp;nbsp;distinct 4,&lt;BR&gt;&amp;nbsp;1,&lt;BR&gt;&amp;nbsp;#OrdersToGet.OrderID,&lt;BR&gt;&amp;nbsp;Null,&lt;BR&gt;&amp;nbsp;Null,&lt;BR&gt;&amp;nbsp;Null,&lt;BR&gt;&amp;nbsp;OrderDetails.OrderID,&lt;BR&gt;&amp;nbsp;Null,&lt;BR&gt;&amp;nbsp;Null,&lt;BR&gt;&amp;nbsp;Null&lt;BR&gt;From [Order Details] as OrderDetails&lt;BR&gt;&amp;nbsp;Join #OrdersToGet&lt;BR&gt;&amp;nbsp;On #OrdersToGet.OrderID = OrderDetails.OrderID&lt;BR&gt;Union All&lt;BR&gt;Select 5,&lt;BR&gt;&amp;nbsp;4,&lt;BR&gt;&amp;nbsp;OrderDetails.OrderID,&lt;BR&gt;&amp;nbsp;Null,&lt;BR&gt;&amp;nbsp;Null,&lt;BR&gt;&amp;nbsp;Null,&lt;BR&gt;&amp;nbsp;OrderDetails.OrderID,&lt;BR&gt;&amp;nbsp;OrderDetails.Quantity,&lt;BR&gt;&amp;nbsp;OrderDetails.UnitPrice,&lt;BR&gt;&amp;nbsp;OrderDetails.ProductId&amp;nbsp;&lt;BR&gt;From [Order Details] as OrderDetails&lt;BR&gt;&amp;nbsp;Join #OrdersToGet&lt;BR&gt;&amp;nbsp;On #OrdersToGet.OrderID = OrderDetails.OrderID &lt;BR&gt;Order By [Order!1!OrderId],Tag,[OrderDetails!4!OrderId!hide]&lt;BR&gt;For XML Explicit &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: The above Sql Statement is part of a stored procedure that &lt;BR&gt;can be downloaded at the end of this blog.&lt;/P&gt;
&lt;P&gt;The XML Explicit clause is used with Unions of Select statements&lt;BR&gt;and the keywords -&amp;gt; Parent and Tag to generate the desired result.&lt;BR&gt;The Order By clause is also very important, when using XML Explicit.&lt;BR&gt;It's a good idea to&amp;nbsp; take off the XML Explicit clause to view the regular sql result set (especially if the &lt;BR&gt;format of your returned XML is incorrect or to help debug). &lt;BR&gt;A good description of the XML Explicit clause with some examples is as below:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsql/ac_openxml_4y91.asp"&gt;Using EXPLICIT Mode&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Below describes how to create a BizTalk xsd Schema for XML returned using a XML Explicit Sql Statement:&lt;/P&gt;
&lt;P&gt;1) Create and test (perhaps using Query Analyzer) a XML Explicit Sql Select statement &lt;BR&gt;that includes the Tag, Parent and Unions of Select Statements.&lt;/P&gt;
&lt;P&gt;2) Create a Sql Receive port that will invoke the Select Statement (this could be a stored proc) &lt;BR&gt;that contains the XML Explicit clause. This Sql Receive Port should use the PassThrough Pipeline.&lt;BR&gt;Note: in the Receive Location properties you must include the namespace of the &lt;BR&gt;generated XML, Root Node name, Select Statement or Stored Procedure. In this example it was : &lt;BR&gt;Document Target NameSpace : http://ObjectSharp/Orders&lt;BR&gt;Document Root Element Name: Orders&lt;BR&gt;Sql Command: exec BTSGetOrders 1000&lt;/P&gt;
&lt;P&gt;3) Create a File Send Port that subscribes to the Receive Port, for example create &lt;BR&gt;a filter on the Send Port with BTS.ReceivePortName = "Name of Receive Port Here"&lt;BR&gt;This Send Port should also use the PassThrough Pipeline.&lt;/P&gt;
&lt;P&gt;4) Turn on the above two ports and let a sample message be placed into the File Location &lt;BR&gt;of the Send Port.&lt;/P&gt;
&lt;P&gt;5) Create a new BizTalk Project or use an existing one and add a Generated Item. Use the Generate &lt;BR&gt;Schemas option and Select -&amp;gt; Well-Formed XML. Select the xml file produced in step 4). &lt;BR&gt;A xsd schema is now generated that can be used in a BizTalk Solution. If this BizTalk &lt;BR&gt;project is deployed, the Receive Port and Send Ports created in Step 2) and 3) can now use the &lt;BR&gt;standard XML Pipelines. &lt;BR&gt;Note : It may be necessary to modify the xsd schema to alter the attribute types &lt;BR&gt;min max properties etc.&lt;/P&gt;
&lt;P&gt;6) The produced xsd schema in 5) can now be used in a BizTalk Solution for Mapping, Messages etc.&lt;BR&gt;Orchestrations can subscribe to xml messages that are derived from a Select Statement that uses&lt;BR&gt;the XML Explicit Clause.&lt;/P&gt;
&lt;P&gt;Conclusion: Select Statements using the XML Explicit clause can generate XML documents &lt;BR&gt;that can be consumed by BizTalk Server 2004. &lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Download the Sample Stored procedure and XSD file &lt;A href="http://www.objectsharp.com/blogs/matt/images/SqlXMLExplicit.zip"&gt;HERE&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Note : The sample uses tables found in the NorthWind Database that is optionally installed with &lt;BR&gt;Sql Server.&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=1560" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>BizTalk Server WebCast -&gt; BizTalk Server 2004 Implementing Enterprise Integration Patterns</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2005/03/15/1545.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2005/03/15/1545.aspx</id><published>2005-03-15T13:06:00Z</published><updated>2005-03-15T13:06:00Z</updated><content type="html">&lt;P&gt;I am doing a WebCast on Mar 28 2005&amp;nbsp; :&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;BizTalk Server 2004 Implementing Enterprise Integration Patterns&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Description:&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp; This intermediate level presentation will discuss how to create various Enterprise Integration Patterns in BizTalk 2004. Discussions and demonstrations will include patterns such as: Message Translator, Message Broker, Message Splitter, and Message Aggregator.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;To sign up :&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www118.livemeeting.com/cc/lmevents/view?id=msft032805ad&amp;amp;pw=RWRP4B" target=_blank&gt;https://www118.livemeeting.com/cc/lmevents/view?id=msft032805ad&amp;amp;pw=RWRP4B&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;(I have updated the link to the recorded webcast. Matt May 10 2005).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=1545" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>Bloggers Guide To BizTalk, Dec 2004 Edition</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2004/12/13/1087.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2004/12/13/1087.aspx</id><published>2004-12-13T15:25:00Z</published><updated>2004-12-13T15:25:00Z</updated><content type="html">&lt;P&gt;If you are working on a BizTalk 2004 project, please follow the below link to download this extremely useful source of information, kindly provided by Alan Smith :&lt;/P&gt;
&lt;P&gt;&lt;A href="http://geekswithblogs.com/asmith/archive/2004/12/12/17341.aspx"&gt;http://geekswithblogs.com/asmith/archive/2004/12/12/17341.aspx&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=1087" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>BizTalk 2004 Map, Getting Distinct Values using an Inline XSLT Call Template</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2004/11/24/1031.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2004/11/24/1031.aspx</id><published>2004-11-24T14:31:00Z</published><updated>2004-11-24T14:31:00Z</updated><content type="html">&lt;P&gt;Need to get a distinct list of items from an XML message.&lt;/P&gt;
&lt;P&gt;For example the XML message containing Order Items is as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/XSLTDistinctBlog1.jpg"&gt;&lt;/P&gt;
&lt;P&gt;(Note: That the Order ids are not sorted)&lt;/P&gt;
&lt;P&gt;From the above message produce a distinct list of order ids such as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/XSLTDistinctBlog2.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;The custom XSLT code to get the distinct list of values looks like this: &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/XSLTDistinctBlog3.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;To use an Inline XSLT Call Template inside of a BizTalk 2004 Map, &lt;BR&gt;a) Create a new Map inside of your BizTalk project&lt;BR&gt;b) Choose the source and destination schemas &lt;BR&gt;c) Drop a Scripting Functoid on the Map, then in the properties window with &lt;BR&gt;the Scripting Functoid selected,  press the -&gt; Configure Functoid Script button.&lt;BR&gt;d) For the Script type choose -&gt; Inline XSLT Call Template. Place the XSLT into the Inline Script Buffer &lt;BR&gt;window.&lt;/P&gt;
&lt;P&gt;The map to get the distinct Order Ids looks like the below: &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/XSLTDistinctBlog4.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Note : The scripting functoid inside of the map has no incoming or outgoing links. &lt;BR&gt;The Custom XSLT will handle the complete transformation. Ignore any warnings about no incoming &lt;BR&gt;or outgoing links when building the project.&lt;/P&gt;
&lt;P&gt;Download the Complete solution &lt;A href="http://www.objectsharp.com/blogs/matt/images/MapDistinctUsingCustomXSLT.zip"&gt;HERE &lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=1031" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>Creating/Modifiying Schemas in BizTalk 2004. Quick Tip.</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2004/11/15/1017.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2004/11/15/1017.aspx</id><published>2004-11-16T01:51:00Z</published><updated>2004-11-16T01:51:00Z</updated><content type="html">&lt;P&gt;When BizTalk 2004 is installed on a developer machine, one of the many things that &lt;BR&gt;is installed is the BizTalk Editor. The BizTalk Editor is used to &lt;BR&gt;create and modify .xsd schemas in VS2003 that will eventually be used in a BizTalk process.&lt;/P&gt;
&lt;P&gt;The BizTalk Editor is broken up into three parts:&lt;BR&gt;1) The left hand side displays a tree structure to add new nodes to the specification.&lt;BR&gt;2) The centre displays the xml markup representation of the schema.&lt;BR&gt;3) The right hand side displays the properties pane, to edit the properties of the currently &lt;BR&gt;highlighed node on the left hand side tree structure.&lt;/P&gt;
&lt;P&gt;This is illustrated below.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SchemaCreationOne.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;One of the limiting factors of the BizTalk Editor is that the centre xml markup representation &lt;BR&gt;is not editable. &lt;/P&gt;
&lt;P&gt;&lt;BR&gt;To be able to edit the xml markup representation of the .xsd schema do this:&lt;BR&gt;1) Right mouse button on the schema and choose Open With... on the pop up menu.&lt;BR&gt;2) A dialog such as the one below will appear -&gt; In this dialog, choose XML Schema editor.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SchemaCreationTwo.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;3) The .xsd schema will now display in the XML Schema Editor. This editor is more object based, &lt;BR&gt;displaying each element in a box. New attributes can be added to the Invoice, Invoices and InvoiceItem &lt;BR&gt;elements. The properties window, can also be used to edit individual attributes.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SchemaCreationthree.jpg"&gt;&lt;/P&gt;
&lt;P&gt;4) While in the editor, at the bottom choose the XML tab, as below.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SchemaCreationFour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;5) Now the below schema can be edited directly. &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/SchemaCreationfive.jpg"&gt;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=1017" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>Constructing BizTalk 2004 XML Messages (In an Orchestration) - Choices</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2004/11/09/1009.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2004/11/09/1009.aspx</id><published>2004-11-10T01:37:00Z</published><updated>2004-11-10T01:37:00Z</updated><content type="html">&lt;P&gt;Before using a BizTalk XML message inside an Orchestration , it must first be &lt;BR&gt;constructed. In fact ,this is just populating the message with XML. If there is an &lt;BR&gt;attempt to use the message before it is constructed, the following error will appear when&amp;nbsp;&lt;BR&gt;building the BizTalk project -&amp;gt; use of unconstructed message 'MyMessageNameHere'.&lt;BR&gt;Some messages come pre-constructed, such as messages that originate from a port, but there &lt;BR&gt;will be times when a message needs to be constructed inside of an orchestration.&lt;/P&gt;
&lt;P&gt;For example if there is a message inside an Orchestration called msgShippingInfo (that is unconstructed), &lt;BR&gt;and is of type ShippingInfo.xsd and the xsd schema looks like the below:&lt;/P&gt;
&lt;P&gt;&amp;lt;?xml version="1.0" encoding="utf-16"?&amp;gt;&lt;BR&gt;&amp;lt;xs:schema xmlns="http://ConstructingXMLMessages.ShippingInfo" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://ConsltructingXMLMessages.ShippingInfo" xmlns:xs="http://www.w3.org/2001/XMLSchema"&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;xs:element name="ShippingInfo"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:complexType&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:attribute name="ShipToAddress" type="xs:string" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:attribute name="ShipToCity" type="xs:string" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:attribute name="ShipToCountry" type="xs:string" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xs:complexType&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;/xs:element&amp;gt;&lt;BR&gt;&amp;lt;/xs:schema&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;?xml version="1.0" encoding="utf-16"?&gt;Then at some point, the message must be populated with some xml as below, before that message can &lt;BR&gt;be used:&lt;/P&gt;
&lt;P&gt;&lt;?xml:namespace prefix = ns0 /&gt;&lt;ns0:ShippingInfo ShipToAddress="Some Address" ShipToCity="Some City" ShipToCountry="Some Country" &lt;BR&gt;&lt;ns0:ShippingInfo ShipToAddress="Some Address" ShipToCity="Some City" ShipToCountry="Some Country" &lt;BR&gt;&lt;ns0:ShippingInfo ShipToAddress="Some Address" ShipToCity="Some City" ShipToCountry="Some Country" xmlns:ns0="http://ConstructingXMLMessages.ShippingInfo"&gt;&lt;/ns0:ShippingInfo&gt;&amp;lt;ns0:ShippingInfo ShipToAddress="Some Address" ShipToCity="Some City" ShipToCountry="Some Country" &lt;BR&gt;xmlns:ns0="http://ConstructingXMLMessages.ShippingInfo" /&amp;gt; &lt;BR&gt;&lt;BR&gt;&lt;BR&gt;Below are some options for constructing XML messages, inside of an Orchestration.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1) Create new message(s) from a existing message(s) using a BizTalk Map.&lt;BR&gt;&lt;/STRONG&gt;This is one of the more common methods. For example, &lt;BR&gt;I need to map my incoming Purchase Order message to an outgoing&lt;BR&gt;Invoice message. Also keep in mind that you can have multiple input messages and output messages &lt;BR&gt;when mapping. For example within an Orchestration, there is an existing constructed Purchase Order and Shipping messages. &lt;BR&gt;I can then use these two messages to create an&amp;nbsp;Order message.&lt;/P&gt;
&lt;P&gt;A simple example is as below:&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/ConstructingMessagesBlog1.jpg"&gt; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have not done it before :&lt;BR&gt;To create a map with multiple inputs and outputs, create the needed messages &lt;BR&gt;in the Orchestration View. For example , in this case an Order message, &lt;BR&gt;PurchaseOrder Message and the Shipping Message.&lt;BR&gt;Drop a transform shape on your orchestration and then choose the source(input) message(s).&lt;BR&gt;In this case there are two : PurchaseOrder message and Shipping message. &lt;BR&gt;Choose the destination(output) message(s) : Order message.&lt;BR&gt;In the Transform Configuration dialog box, choose -&amp;gt; new map. In this case &lt;BR&gt;a new map is created that looks like the above (minus any of the links and functoids between source and &lt;BR&gt;destination messages). These were put in later.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2) Assign one message to another.&lt;BR&gt;&lt;/STRONG&gt;At some point you may need a copy of another message. If msgOrderCopy is of the same type &lt;BR&gt;as msgOrderOriginal, then the below assignment can be done.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Construct msgOrderCopy&lt;BR&gt;{ &lt;/P&gt;
&lt;P&gt;&amp;nbsp; msgOrderCopy = msgOrderOriginal;&lt;BR&gt;&amp;nbsp; //Once the new message is constructed, it can now be modified.&lt;BR&gt;&amp;nbsp; // For example if the schema for the order has distinguished fields,&lt;BR&gt;&amp;nbsp; // these can now be set.&amp;nbsp;XPATH can also be used to set the data in (Some xpath examples are further down).&lt;BR&gt;&amp;nbsp; msgOrderCopy.OrderedBy = "Bob";&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;3) Create a message with the help of a System.XML.XMLDocument variable.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;In the below example, the XML to populate the message is hardcoded inside the &lt;BR&gt;expression shape. The XMLDocument variable is initially assigned to the hardcoded XML. The BizTalk message is &lt;BR&gt;then assigned to the XMLDocument variable. The BizTalk message is now good to go. &lt;BR&gt;This is a handy technique especially when the schemas/xml instance messages are small. If the schema &lt;BR&gt;has distinguished fields, then these can then be used to set the attributes in the message with real data, otherwise XPATH &lt;BR&gt;can be used to populate the ID and Name attributes of the below simple XML message. It is also &lt;BR&gt;possible to alter the hardcoded XML with the real data, and then do the message assignments.&lt;/P&gt;
&lt;P&gt;construct msgShipping&lt;BR&gt;{&lt;BR&gt;&amp;nbsp; // Use the Variable varXMLDom to load in some XML&lt;BR&gt;&amp;nbsp;varXMLDom.LoadXml(@"&amp;lt;ns0:ShippingInfo ShipToAddress=""Some Address"" ShipToCity=""Some City"" ShipToCountry=""Some Country"" xmlns:ns0=""http://ConstructingXMLMessages.ShippingInfo"" /&amp;gt;");&lt;BR&gt;&amp;nbsp; // Assign the BizTalk message to the XMLDom variable. Note this can be accomplished becuase a BizTalk message derives from an XMLDocument.&lt;BR&gt;&amp;nbsp; msgShipping = varXMLDom;&lt;BR&gt;&amp;nbsp; // If there are Distinguished Fields available, then &lt;BR&gt;&amp;nbsp; msgShipping.ShipToAddress = "1 Main Street";&lt;BR&gt;&amp;nbsp; msgShipping.ShipToCity = "Toronto";&lt;BR&gt;&amp;nbsp; msgShipping.ShipToCountry = "Canada";&lt;BR&gt;&amp;nbsp; // If there are no distinguished fields, then XPATH can be used to set the attributes in the message.&lt;BR&gt;&amp;nbsp; xpath(msgShipping , "&lt;A&gt;//@ShipToAddress&lt;/A&gt;") = "1 Main Street";&lt;BR&gt;&amp;nbsp; xpath(msgShipping, "&lt;A&gt;//@ShipToCity&lt;/A&gt;") = "Toronto";&lt;BR&gt;&amp;nbsp; xpath(msgShipping, "&lt;A&gt;//@ShipToCountry&lt;/A&gt;") = "Canada";&lt;BR&gt;&amp;nbsp; &lt;BR&gt;}&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;4) Creating a more complex message using : System.XML.Document, System.XML.XMLNode,System.XML. XMLAttribute, Interim BizTalk Message &lt;/STRONG&gt;&lt;STRONG&gt;&lt;BR&gt;&lt;/STRONG&gt;The below example, uses the same method as in 3) , but the message is more complicated. &lt;BR&gt;A Looping shape is used to add the order items to an order message. The part of the orchestration that does this &lt;BR&gt;is as below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/ConstructingMessagesBlog2.jpg"&gt; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;In the the First Expression Shape, Construct the initial Order Message (With just the Order Header), with the help of a XMLDocument variable&lt;BR&gt;construct msgOrderFromAppending&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp; // Initially create the Order Header part of the Order Message&lt;BR&gt;&amp;nbsp;&amp;nbsp; varOrderXMLDom.LoadXml(@"&amp;lt;ns0:Order OrderedBy=""SomeBody"" TotalOrderAmount=""0"" xmlns:ns0=""http://ConstructingXMLMessages.Orders""&amp;gt;&amp;lt;/ns0:Order&amp;gt;");&lt;BR&gt;&amp;nbsp;&amp;nbsp; msgOrderFromAppending = varOrderXMLDom;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;In the next expression shape add the order items. Note that in the Orchestration this expression&lt;BR&gt;shape is in a loop, so there are multiple order items being added. &lt;/P&gt;
&lt;P&gt;&lt;BR&gt;// Construct the Temp Order Message to Append the Node.&lt;BR&gt;construct msgOrderFromAppendingTemp&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp; // First set the XMLDOM variable to the msgOrderFromAppending in the first shape.&lt;BR&gt;&amp;nbsp;&amp;nbsp; varOrderXMLDom = msgOrderFromAppending;&lt;BR&gt;&amp;nbsp;&amp;nbsp; // use CloneNode to make a fresh copy of msgOrderFromAppending&lt;BR&gt;&amp;nbsp;&amp;nbsp; varOrderXMLDom = (System.Xml.XmlDocument) varOrderXMLDom.CloneNode(true);&lt;BR&gt;&amp;nbsp;&amp;nbsp; // Create a new Order Item Node&lt;BR&gt;&amp;nbsp;&amp;nbsp; varXMLNodeOrderItemNode = varOrderXMLDom.CreateElement("OrderItems");&lt;BR&gt;&amp;nbsp;&amp;nbsp; // Create Amount Attribute&lt;BR&gt;&amp;nbsp;&amp;nbsp; varXMLAttribute = varOrderXMLDom.CreateAttribute("Amount");&lt;BR&gt;&amp;nbsp;&amp;nbsp; varXMLAttribute.InnerText = "0";&lt;BR&gt;&amp;nbsp;&amp;nbsp; varXMLNodeOrderItemNode.Attributes.Append(varXMLAttribute);&lt;BR&gt;&amp;nbsp;&amp;nbsp; // Create Description Attribute&lt;BR&gt;&amp;nbsp;&amp;nbsp; varXMLAttribute = varOrderXMLDom.CreateAttribute("Description");&lt;BR&gt;&amp;nbsp;&amp;nbsp; varXMLAttribute.InnerText = "A Description";&lt;BR&gt;&amp;nbsp;&amp;nbsp; varXMLNodeOrderItemNode.Attributes.Append(varXMLAttribute);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp; // Create Qty Attribute&lt;BR&gt;&amp;nbsp;&amp;nbsp; varXMLAttribute = varOrderXMLDom.CreateAttribute("Qty");&lt;BR&gt;&amp;nbsp;&amp;nbsp; varXMLAttribute.InnerText = "0";&lt;BR&gt;&amp;nbsp;&amp;nbsp; varXMLNodeOrderItemNode.Attributes.Append(varXMLAttribute);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp; // Now append the actual Order Item Node to the XML Instance &lt;BR&gt;&amp;nbsp;&amp;nbsp; varOrderXMLDom.FirstChild.AppendChild(varXMLNodeOrderItemNode);&lt;BR&gt;&amp;nbsp;&amp;nbsp; // Now actually construct the Temp message.&lt;BR&gt;&amp;nbsp;&amp;nbsp; msgOrderFromAppendingTemp = varOrderXMLDom;&lt;BR&gt;&amp;nbsp;&amp;nbsp; System.Diagnostics.Debug.WriteLine("The output is " + varOrderXMLDom.OuterXml);&lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;// Now Set the Real Order Message From the Temp Message. &lt;BR&gt;// This is so we can keep adding messages to the real message, without losing them.&lt;/P&gt;
&lt;P&gt;construct msgOrderFromAppending&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp; msgOrderFromAppending = msgOrderFromAppendingTemp;&lt;BR&gt;&amp;nbsp;&amp;nbsp; // Set the Data in the newly added Order Item Node. &lt;BR&gt;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp; // Now use XPAth to set the Data in the attributes, &lt;BR&gt;&amp;nbsp;&amp;nbsp; // NOTE: I could of also done this by setting the real data &lt;BR&gt;&amp;nbsp;&amp;nbsp; // on the XMLAttribute object -&amp;gt; varXMLAttribute.InnerText = "Description for Order Item : " +&amp;nbsp; System.Convert.ToString(varOrderItemCount) ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; strvarOrderItemCount = System.Convert.ToString(varOrderItemCount);&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp; xpath(msgOrderFromAppending,"//OrderItems[" + strvarOrderItemCount + "]//@Amount") = System&amp;nbsp; m.Convert.ToString(varOrderItemCount) ;&lt;BR&gt;&amp;nbsp;&amp;nbsp; xpath(msgOrderFromAppending,"//OrderItems[" + strvarOrderItemCount + "]//@Qty") = System.Convert.ToString(varOrderItemCount) ;&lt;BR&gt;&amp;nbsp;&amp;nbsp; xpath(msgOrderFromAppending,"//OrderItems[" + strvarOrderItemCount + "]//@Description") = "Description for Order Item : " +&amp;nbsp; System.Convert.ToString(varOrderItemCount) ;&amp;nbsp; &lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;5) Use a .Net helper class to create the message. &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;As in the above example , instead of using XMLDOM type code in the orchestration, a helper &lt;BR&gt;.NET class could of been called in the orchestration to create the message. &lt;BR&gt;An example helper class would look like the below, just returning an XMLDocument that could be assigned to &lt;BR&gt;the message inside the orchestration.&lt;/P&gt;
&lt;P&gt;public static XmlDocument GetXmlDocumentOrderTemplate()&lt;BR&gt;{&lt;BR&gt;// Code to create the message. &lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;Now inside the orchestration, the code to call the .Net helper class to construct the message.&lt;/P&gt;
&lt;P&gt;Construct myOrderMessage&lt;BR&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; myOrderMessage = HelperClass.GetXmlDocumentOrderTemplate&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;Also look &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_prog_orch_guxr.asp"&gt;here&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Download the above examples , &lt;A href="http://www.objectsharp.com/blogs/matt/images/ConstructingXMLMessages.zip"&gt;Here&lt;/A&gt;&lt;/P&gt;&lt;/ns0:ShippingInfo&gt;&lt;/ns0:ShippingInfo&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=1009" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>BizTalk 2004 Map. Mapping two input messages into one output message , plus matching content from one message to another.</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2004/11/01/991.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2004/11/01/991.aspx</id><published>2004-11-01T13:03:00Z</published><updated>2004-11-01T13:03:00Z</updated><content type="html">&lt;P&gt;I have had the problem of having a message such as a Order message, being delivered&amp;nbsp; &lt;BR&gt;as two separate messages. For example, the Order header Records delivered as one XML message, &lt;BR&gt;and then all the Order Items that belong to Order header Records delivered as a separate XML message.&lt;/P&gt;
&lt;P&gt;The two separate messages being delivered look something like below:&lt;/P&gt;
&lt;P&gt;Order Headers:&lt;/P&gt;
&lt;P&gt;&lt;?xml:namespace prefix = ns0 /&gt;&lt;ns0:Orders xmlns:ns0="http://IDREFTest.Orders" Correlator="1"&gt;&amp;lt;ns0:Orders Correlator="1" xmlns:ns0="http://IDREFTest.Orders"&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;Order OrderID="6" OrderedBy="BillyBobJim" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;Order OrderID="1" OrderedBy="Bob" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;Order OrderID="2" OrderedBy="Bobby" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;Order OrderID="3" OrderedBy="BobbyJohn" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;Order OrderID="4" OrderedBy="BobbyNoItems" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;Order OrderID="5" OrderedBy="BillyBob" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;Order OrderID="0022" OrderedBy="BillyBobJim" /&amp;gt;&lt;BR&gt;&amp;lt;/ns0:Orders&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;ORDER OrderID="6" OrderedBy="BillyBobJim" /&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;/ns0:Orders&gt;Order Items:&lt;/P&gt;
&lt;P&gt;&lt;ns0:Order xmlns:ns0="http://IDREFTest.OrderItems" Correlator="1"&gt;&amp;lt;ns0:Order Correlator="1" xmlns:ns0="http://IDREFTest.OrderItems"&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;OrderItems OrderID="1" Qty="1" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;OrderItems OrderID="1" Qty="11" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;OrderItems OrderID="1" Qty="111" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;OrderItems OrderID="2" Qty="2" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;OrderItems OrderID="2" Qty="22" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;OrderItems OrderID="2" Qty="222" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;OrderItems OrderID="3" Qty="3" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;OrderItems OrderID="3" Qty="33" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;OrderItems OrderID="3" Qty="333" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;OrderItems OrderID="3" Qty="3333" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;OrderItems OrderID="5" Qty="5" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;OrderItems OrderID="5" Qty="1" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;OrderItems OrderID="5" Qty="11" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;OrderItems OrderID="5" Qty="111" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;OrderItems OrderID="6" Qty="333" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;OrderItems OrderID="6" Qty="3333" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;OrderItems OrderID="0022" Qty="3" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;OrderItems OrderID="0022" Qty="33" /&amp;gt;&lt;BR&gt;&amp;lt;/ns0:Order&amp;gt;&lt;BR&gt;&lt;ORDERITEMS OrderID="1" Qty="1" /&gt;&lt;BR&gt;&lt;/ns0:Order&gt;&lt;/P&gt;
&lt;P&gt;
&lt;P&gt;&lt;ns0:Order xmlns:ns0="http://IDREFTest.OrderItems" Correlator="1"&gt;&lt;/ns0:Order&gt;&lt;/P&gt;My goal then was to create a final Order XML Message that looks like the below (combining &lt;BR&gt;information from the two messages into one message, plus also matching the correct order items with &lt;BR&gt;the correct order headers). I wanted to accomplish this by just using BTS maps and functoids &lt;BR&gt;that are installed with BTS2004.&lt;ns0:Orders xmlns:ns0="http://IDREFTest.OrdersandOrderItems"&gt;&lt;ns0:Orders xmlns:ns0="http://IDREFTest.OrdersandOrderItems"&gt;&lt;BR&gt;&lt;ORDER OrderID="6" OrderedBy="BillyBobJim"&gt;&lt;BR&gt;&lt;ORDERITEMS OrderID="6" Qty="3333" /&gt;&lt;ns0:Orders xmlns:ns0="http://IDREFTest.OrdersandOrderItems"&gt;&amp;lt;ns0:Orders xmlns:ns0="http://IDREFTest.OrdersandOrderItems"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;Order OrderedBy="BillyBobJim" OrderID="6"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderItems OrderID="6" Qty="333" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderItems OrderID="6" Qty="3333" /&amp;gt; &lt;BR&gt;&amp;lt;/Order&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;Order OrderedBy="Bob" OrderID="1"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderItems OrderID="1" Qty="1" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderItems OrderID="1" Qty="11" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderItems OrderID="1" Qty="111" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;lt;/Order&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Order OrderedBy="Bobby" OrderID="2"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;OrderItems OrderID="2" Qty="2" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderItems OrderID="2" Qty="22" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderItems OrderID="2" Qty="222" /&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;/Order&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;lt;Order OrderedBy="BobbyJohn" OrderID="3"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderItems OrderID="3" Qty="3" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderItems OrderID="3" Qty="33" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderItems OrderID="3" Qty="333" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderItems OrderID="3" Qty="3333" /&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;/Order&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;Order OrderedBy="BobbyNoItems" OrderID="4" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;lt;Order OrderedBy="BillyBob" OrderID="5"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderItems OrderID="5" Qty="5" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderItems OrderID="5" Qty="1" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderItems OrderID="5" Qty="11" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderItems OrderID="5" Qty="111" /&amp;gt;&amp;nbsp; &lt;BR&gt;&amp;nbsp; &amp;lt;/Order&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;Order OrderedBy="BillyBobJim" OrderID="0022"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderItems OrderID="0022" Qty="3" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;OrderItems OrderID="0022" Qty="33" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;lt;/Order&amp;gt;&lt;BR&gt;&amp;lt;/ns0:Orders&amp;gt;&amp;nbsp;&lt;ORDER OrderID="6" OrderedBy="BillyBobJim"&gt;&lt;BR&gt;&lt;/ns0:Orders&gt;&lt;/ns0:Orders&gt;&lt;/ns0:Orders&gt;
&lt;P&gt;Therefore to accomplish this:&lt;/P&gt;
&lt;P&gt;1) Created an Orchestration that contains a parallel convoy, that correlates on &lt;BR&gt;the Correlator attribute on both the Orders.xsd and OrderItems.xsd properties.&lt;/P&gt;
&lt;P&gt;2) Created a Map with two inputs (Order Header and Order Items) and one output (OrdersAndOrderItemsAll).&amp;nbsp; &lt;BR&gt;To create a map with multiple inputs and outputs, create the needed messages &lt;BR&gt;in the Orchestration View. For example , in this case an OrdersOnly message, &lt;BR&gt;OrderItemsOnly Message and the OrdersAndOrderItemsAll Message.&lt;BR&gt;Drop a transform shape on your orchestration and then choose the source(input) message(s).&lt;BR&gt;In this case there are two : OrdersOnly message and OrderItemsOnly message. &lt;BR&gt;Choose the destination(output) message(s) : OrdersAndOrderItemsAll message.&lt;BR&gt;In the Transform Configuration dialog box, choose -&amp;gt; new map. In this case &lt;BR&gt;a new map is created that looks like the below (minus any of the links and functoids between source and &lt;BR&gt;destination messages). These were put in later.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/MappingTwoIntoOneBlog1.jpg"&gt; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;3) In the map as above, links and two looping functoids were used to create an interim message (OrdersAndOrderItemsAll) &lt;BR&gt;All OrderHeader records will contain all the OrderItem records.&lt;/P&gt;
&lt;P&gt;4) Create another map that looks like the below, using the OrdersAndOrderItemsAll message as the source and using a new&lt;BR&gt;message OrdersAndOrderItems as the destination. The equal functoid is used to include only the correct orderitems with each&lt;BR&gt;order header. This map creates the desired resultant xml instance.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.objectsharp.com/blogs/matt/images/MappingTwoIntoOneBlog2.jpg"&gt; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Download the complete solution &lt;A href="http://www.objectsharp.com/blogs/matt/images/IDREFTest.zip"&gt;Here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;What I like about this solution, is that it works. What I don't like about this solution is the interim message, with each order header message&lt;BR&gt;including all the order items. In my case the incoming OrderHeader message and OrderItem messages were not terribly large, therefore &lt;BR&gt;the interim message was not huge. Of course there may be other ways to accomplish this, possibly using custom xslt.&lt;BR&gt;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=991" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>Passing an XML instance to a Web Service Method via a BizTalk 2004 Orchestration Web Port -&gt; Choices.</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2004/10/30/989.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2004/10/30/989.aspx</id><published>2004-10-30T23:40:00Z</published><updated>2004-10-30T23:40:00Z</updated><content type="html">&lt;P&gt;Need to call a web method from a BizTalk 2004 Orchestration Web Port and pass an instance of XML to the web method.&lt;BR&gt;Below are some options:&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;1) Pass the XML as a string.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;For example your Web Method that you need to call from your orchestration might look something like this:&lt;/P&gt;
&lt;P&gt;[WebMethod]&lt;BR&gt;ProcessOrder (string myOrder)&lt;BR&gt;{&lt;/P&gt;
&lt;P&gt; System.XML.XMLDocument myOrderDom = new System.XML.XMLDocument()&lt;BR&gt; myOrderDom.load(myOrder)&lt;BR&gt;   // Now have code to process the order&lt;BR&gt; System.Xml.XmlNodeList nodeList = myOrderDom.GetElementsByTagName("OrderItems");&lt;BR&gt; System.Diagnostics.Debug.WriteLine("The number of Order Items passed in with the XMLDocument is: " + nodeList.Count.ToString());&lt;BR&gt; foreach(System.Xml.XmlNode orderItemNode in nodeList)&lt;BR&gt; {&lt;BR&gt;  System.Diagnostics.Debug.WriteLine("The order item node is : " + orderItemNode.OuterXml);&lt;/P&gt;
&lt;P&gt; } &lt;BR&gt; &lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;In the Orchestration :&lt;BR&gt;To create the XML string representation of the message in your orchestration:&lt;BR&gt;a) In your orchestration create a variable of type System.XML.XMLDocument&lt;/P&gt;
&lt;P&gt;System.XML.XMLDocument varXMLDOM&lt;/P&gt;
&lt;P&gt;b) In an expression shape assign the XMLDocument type variable to the message that &lt;BR&gt;you want to pass to the XMLDocument.&lt;/P&gt;
&lt;P&gt;varXMLDOM = msgIncomingOrder;&lt;/P&gt;
&lt;P&gt;c) Finally set the message that contains the string parameter that will be passed to the Web Method:&lt;/P&gt;
&lt;P&gt;msgXMLStringRequest.XMLAsString = varXMLDOM.OuterXml;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;2) Pass the XML as a System.XML.XMLDocument&lt;/STRONG&gt;&lt;BR&gt;For example your Web Method that you need to call from your Orchestration might look something like this:&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;[WebMethod]&lt;BR&gt;ProcessOrder (system.XMl.XMLDocument myOrder)&lt;BR&gt;{&lt;/P&gt;
&lt;P&gt; System.Xml.XmlNodeList nodeList = myOrder.GetElementsByTagName("OrderItems");&lt;BR&gt; System.Diagnostics.Debug.WriteLine("The number of Order Items passed in with the XMLDocument is: " + nodeList.Count.ToString());&lt;BR&gt; foreach(System.Xml.XmlNode orderItemNode in nodeList)&lt;BR&gt; {&lt;BR&gt;  System.Diagnostics.Debug.WriteLine("The order item node is : " + orderItemNode.OuterXml);&lt;/P&gt;
&lt;P&gt; }&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;In the Orchestration :&lt;BR&gt;To set the message that contains the XMLDocument parameter that will be passed to the Web Method , simply set the web message to the orchestration message :&lt;BR&gt;msgXMLDomRequest.XMLAsXMLDocument = msgIncomingOrder;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;3) Pass the XML as a Strongly Typed Class&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Your order class (defined on the Web Service side) might look something like this :&lt;/P&gt;
&lt;P&gt;[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://PassingXMLToWS.Orders")]&lt;BR&gt;[System.Xml.Serialization.XmlRootAttribute(Namespace="http://PassingXMLToWS.Orders", IsNullable=false)]&lt;BR&gt;public class Orders &lt;BR&gt;{    &lt;BR&gt; [System.Xml.Serialization.XmlElementAttribute("OrderItems", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]&lt;BR&gt; public OrdersOrderItems[] OrderItems;&lt;/P&gt;
&lt;P&gt; [System.Xml.Serialization.XmlAttributeAttribute()]&lt;BR&gt; public string OrderId;&lt;BR&gt;    &lt;BR&gt; [System.Xml.Serialization.XmlAttributeAttribute()]&lt;BR&gt; public string TotalAmount;&lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://PassingXMLToWS.Orders")]&lt;BR&gt;public class OrdersOrderItems &lt;BR&gt;{&lt;BR&gt;    &lt;BR&gt; [System.Xml.Serialization.XmlAttributeAttribute()]&lt;BR&gt; public string OrderItemId;&lt;BR&gt;    &lt;BR&gt; [System.Xml.Serialization.XmlAttributeAttribute()]&lt;BR&gt; public string ItemAmount;&lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;Note: I created the above class by using the xsd utility that is installed with VS.Net.&lt;BR&gt;a) I created an xsd BizTalk Schema, and called it Orders.xsd&lt;BR&gt;b) I then generated the above class, by opening up the Visual Studio Command Prompt and then&lt;BR&gt;typing in the following :&lt;BR&gt;c:\passxmltowebservice&gt; xsd Orders.xsd /c /l:cs&lt;BR&gt;c) The xsd utility then created a class for me called, Orders.cs, which I then copied over to&lt;BR&gt;my web service project.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Your Web method that accepts an Order class might look like the below:&lt;/P&gt;
&lt;P&gt;[WebMethod]&lt;BR&gt;public void AcceptOrderClass(Orders myOrders)&lt;BR&gt;{&lt;BR&gt; System.Diagnostics.Debug.WriteLine("In AcceptOrderClass");&lt;BR&gt; System.Diagnostics.Debug.WriteLine("The Id of the Order passed in is: " + myOrders.OrderId);&lt;BR&gt; foreach (OrdersOrderItems orderItem in myOrders.OrderItems)&lt;BR&gt; {&lt;BR&gt;  System.Diagnostics.Debug.WriteLine("The Id of the Order Item is " + orderItem.OrderItemId); &lt;BR&gt; }&lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;In your BizTalk project, when the Web Reference is added, &lt;BR&gt;an XSD schema will be created that represents the Orders class (Called Reference.xsd). &lt;BR&gt;Inside your Orchestration you create a message of type Reference.xsd and then construct this message, just like any other message.&lt;BR&gt;When your message reaches the web service side it will automatically be converted to an instance of -&gt; public class Orders   &lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;A href="http://www.objectsharp.com/blogs/matt/images/PassingXMLToWS.zip"&gt;Here&lt;/A&gt; is a sample of each.&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;&lt;BR&gt; &lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=989" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="Newsletter" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/Newsletter/default.aspx" /><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>Passing a Binary as a parameter to a Web Method from a BizTalk 2004 Orchestration Web Port</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2004/10/21/952.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2004/10/21/952.aspx</id><published>2004-10-21T12:48:00Z</published><updated>2004-10-21T12:48:00Z</updated><content type="html">&lt;P&gt;Christof Claessens has an excellent &lt;A href="http://weblogs.asp.net/christof_claessens/archive/2004/07/08/177551.aspx"&gt;entry&lt;/A&gt; on how to pass a binary object &lt;BR&gt;to a Send Port, such as a file send port. The binary that is saved by the  &lt;BR&gt;send port using his method will automatically be saved to its native format when written out to a file. For &lt;BR&gt;example : c:\myBTS2004SendLocation\MyExcelFile.xls&lt;/P&gt;
&lt;P&gt;But using the above will not necessarily work when calling a web method &lt;BR&gt;via a BizTalk Orchestration Web Port as below: &lt;/P&gt;
&lt;P&gt;[WebMethod]&lt;BR&gt;ProcessBinary (System.XML.XMLDocument binaryDocument) &lt;BR&gt;{&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;The Web Method is expecting well formed XML that is not present in the binary document.&lt;BR&gt;When the Web Service is called from the orchestration, the Web Service will throw an error.&lt;/P&gt;
&lt;P&gt;A possible solution is to convert the binary document to an array Of bytes&lt;BR&gt;and then call a web method via a BizTalk Orchestration Web Port as below:&lt;/P&gt;
&lt;P&gt;[WebMethod]&lt;BR&gt;ProcessBinary (System.Byte[] binaryDocument)&lt;BR&gt;{&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;But when you try to add the Web Reference to a BizTalk project, you will get an error such as:&lt;BR&gt;Could not generate BizTalk files. An (WebMethodName) operation parameter &lt;BR&gt;or return type is an Array. Array types are not supported.&lt;/P&gt;
&lt;P&gt;A very simple solution is to convert the binary document to an array of bytes, &lt;BR&gt;then convert the array of bytes to a string using something like the code below: &lt;/P&gt;
&lt;P&gt;byte[] myBytes;&lt;BR&gt;FileStream fs = new FileStream(@"C:\myExcelDoc.xls",FileMode.Open, FileAccess.Read);&lt;BR&gt;BinaryReader r = new BinaryReader(fs);&lt;BR&gt;myBytes = r.ReadBytes(Convert.ToInt32(r.BaseStream.Length));&lt;BR&gt;// Now convert the array of bytes to a string.&lt;BR&gt;string myBase64String;&lt;BR&gt;myBase64String = Convert.ToBase64String(myArrayofBytes);&lt;/P&gt;
&lt;P&gt;The above string can now be passed to the below web method via a &lt;BR&gt;BizTalk Orchestration Web Port as below:&lt;/P&gt;
&lt;P&gt;[WebMethod]&lt;BR&gt;ProcessBinary (System.String binaryDocument)&lt;BR&gt;{&lt;/P&gt;
&lt;P&gt; byte[] arrayOfBytes; &lt;BR&gt; arrayOfBytes = Convert.FromBase64String(binaryDocument);&lt;BR&gt; FileStream fs = new FileStream(@&amp;#8220;c:\fileout.xls&amp;#8220;, FileMode.CreateNew);&lt;BR&gt; BinaryWriter w = new BinaryWriter(fs);&lt;BR&gt; w.Write(arrayOfBytes);   &lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;A href="http://www.objectsharp.com/blogs/matt/images/BinaryProcessor.zip"&gt;Here &lt;/A&gt;download the complete solution.&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;&lt;BR&gt; &lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=952" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>BizTalk 2004 Presentation</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2004/06/13/633.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2004/06/13/633.aspx</id><published>2004-06-14T02:12:00Z</published><updated>2004-06-14T02:12:00Z</updated><content type="html">&lt;P&gt;I am doing a BizTalk 2004 presentation on Wed. June 16 at the Metro Toronto .NET User Group. So if you can make it please come.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.metrotorontoug.com/User+Group+Events/97.aspx"&gt;http://www.metrotorontoug.com/User+Group+Events/97.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt; &lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=633" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="BizTalk" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/BizTalk/default.aspx" /></entry><entry><title>DebugView/OutputDebugString Lives in .NET</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2004/05/23/debugview-outputdebugstring-lives-in-net.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2004/05/23/debugview-outputdebugstring-lives-in-net.aspx</id><published>2004-05-23T20:20:00Z</published><updated>2004-05-23T20:20:00Z</updated><content type="html">&lt;p&gt;Back in my COM+ VB6 days I always had a tough time&amp;nbsp; to &lt;br&gt;debug into my VB6 components that were running in a dllhost (COM+ Server Application &lt;br&gt;environment). Basically when the call jumped into the component that was hosted &lt;br&gt;by COM+ , it would sometimes do funny things like hang the VB6 debug session.&lt;/p&gt;
&lt;p&gt;So one method&amp;nbsp;to help debug, was to use an api in the code called OutputDebugString in&amp;nbsp;addition with a little application called DBWIN32.exe, to capture and display the OutputDebugString calls in the code.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;In a nutshell DBWIN32 is a little window that captures and displays any Win32 debug output.&lt;br&gt;&amp;nbsp;&lt;br&gt;So in the VB6 COM+ component code , basically when I needed to debug something I would put in the &lt;br&gt;code:&lt;/p&gt;
&lt;p&gt;OutputDebugString("I am debugging") &lt;/p&gt;
&lt;p&gt;Then if the DBWIN32 window was up and running it would append to it's output:&lt;/p&gt;
&lt;p&gt;July 7 2003 10:02:03&amp;nbsp;&amp;nbsp;&amp;nbsp; I am debugging&lt;/p&gt;
&lt;p&gt;&lt;br&gt;Does this work in .NET? -&amp;gt; Yes. But the nice thing about it is that you do not have to &lt;br&gt;use OutputDebugString API calls to add to the Win32 debug output.&lt;/p&gt;
&lt;p&gt;Instead all I have to do is call something that I am sure you are familiar with such as:&lt;/p&gt;
&lt;p&gt;System.Diagnostics.Debug.WriteLine("I am debugging"); or &lt;br&gt;System.Diagnostics.Trace.WriteLine("I am Tracing");&lt;/p&gt;
&lt;p&gt;To try this out (if you haven't already, go ahead do it, you might find this useful later!) go to the following&lt;br&gt;site and download debugview :&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.sysinternals.com/"&gt;http://www.sysinternals.com/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is not a full blown install, but only a zip file with a little exe in it. Once you have unzipped Dbgview.exe:&lt;/p&gt;
&lt;p&gt;1) Run Dbgview.exe. The little DebugView window will be launched.&lt;br&gt;2) Create a new .NET windows or .NET&amp;nbsp;ASP application.&lt;br&gt;3) Somewhere in the code put (make sure the code is called on startup)&lt;/p&gt;
&lt;p&gt;System.Diagnostics.Debug.WriteLine("I am debugging");&lt;br&gt;System.Diagnostics.Trace.WriteLine("I am Tracing");&lt;/p&gt;
&lt;p&gt;4) Compile it, (but make sure that it is the debug version).&lt;br&gt;5) Run the .exe (Windows) or navigate to the URL (ASP.Net) to run the debug version. &lt;br&gt;(Note if you are in VS.NET go to menu choice Debug/Start Without Debugging or &lt;br&gt;the VS.NET Output Window will grab the debug Win32 output)&lt;br&gt;6) In the Dbgview.exe output window you should see something like:&lt;/p&gt;
&lt;p&gt;20 3:35:37 &amp;nbsp;[3476] I am debugging&lt;br&gt;20 3:35:38 &amp;nbsp;[3476] I am Tracing&lt;/p&gt;
&lt;p&gt;&lt;br&gt;Why is this useful? :&lt;/p&gt;
&lt;p&gt;1) If you have not set up a listener for your Debug or Trace output, you will &lt;br&gt;not see the debug or trace output if your are running outside the VS.NET environment.&lt;br&gt;2) This is extremely useful for Biztalk 2004 debugging , but go here to &lt;br&gt;see why :&lt;br&gt;&lt;a href="http://blogs.msdn.com/darrenj/archive/2004/04/29/123254.aspx"&gt;http://blogs.msdn.com/darrenj/archive/2004/04/29/123254.aspx&lt;/a&gt;&lt;br&gt;3) If you are bored you can always see what else is logging Win32 debug output.&lt;br&gt;4) For other Win32 debug output listeners and discussions go here : &lt;br&gt;&lt;a href="http://weblogs.asp.net/cszurgot/archive/2003/05/21/7368.aspx"&gt;http://weblogs.asp.net/cszurgot/archive/2003/05/21/7368.aspx&lt;/a&gt;&lt;br&gt;&lt;/p&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=501" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author></entry><entry><title>Biztalk Server 2004 / InfoPath,Excel  / Sharepoint. </title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2004/05/23/500.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2004/05/23/500.aspx</id><published>2004-05-23T17:50:00Z</published><updated>2004-05-23T17:50:00Z</updated><content type="html">&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the last month or so I have been using the Sharepoint Adapter for Biztalk 2004.&lt;BR&gt;&lt;A href="http://www.gotdotnet.com/Community/Workspaces/viewuploads.aspx?id=0d1aa85c-cf8d-497e-84f4-3ffec8db1"&gt;&lt;A href="http://www.gotdotnet.com/Community/Workspaces/viewuploads.aspx?id=0d1aa85c-cf8d-497e-84f4-3ffec8db115f"&gt;http://www.gotdotnet.com/Community/Workspaces/viewuploads.aspx?id=0d1aa85c-cf8d-497e-84f4-3ffec8db1&lt;/A&gt;15f&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;What the Sharepoint Adapter does in a nutshell is allow Biztalk &lt;BR&gt;Server to poll for documents posted to a Sharepoint Document Library, grab them &lt;BR&gt;and process them. Biztalk Server can also post a document up to a Sharepoint Document Library.&lt;/P&gt;
&lt;P&gt;Why should anyone care about this?&lt;/P&gt;
&lt;P&gt;1) Sharepoint Web Sites are a snap to set up. &lt;BR&gt;For example : I can easily set up a Sharepoint Site for employees to &lt;BR&gt;submit vacation requests or timesheets.&lt;/P&gt;
&lt;P&gt;2) InfoPath and Excel (part of Office 2003) easily integrate with XML Schemas.&lt;BR&gt;For example: The Vacation Request or timesheets that the employee must fill in &lt;BR&gt;can be easily be created using InfoPath or Excel using an XML Schema as a datasource.&lt;/P&gt;
&lt;P&gt;3) InfoPath Scares me. &lt;BR&gt;Not because it's difficult to use , but because it is a snap to design a powerful functional&amp;nbsp; &lt;BR&gt;InfoPath form using an existing XML Schema or a database as a datasource. &lt;BR&gt;With an InfoPath form, you can connect to a Web Service to populate a dropdown, &lt;BR&gt;do validations, and very easily create a smart client interface with minimal coding. InfoPath has a whole host of&amp;nbsp; &lt;BR&gt;controls such as DropDowns,&amp;nbsp; Calendars, Buttons , Repeating Tables&amp;nbsp; Master Detail Tables and many&amp;nbsp; &lt;BR&gt;more. When the InfoPath document is saved it will automatically populate the XML Schema(s) that it&amp;nbsp; &lt;BR&gt;is bound to.&lt;/P&gt;
&lt;P&gt;Just to give you a high level&amp;nbsp; workflow that incorporates &lt;BR&gt;Biztalk 2004/ InfoPath / and Sharepoint.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;1) The user will go into the Sharepoint Web Site. &lt;BR&gt;Navigate to the Vacation Request Document Library&lt;BR&gt;2) Hit the New Vacation Request form button.&lt;BR&gt;3) Fill out the form.&lt;BR&gt;4) Hit Save.&lt;BR&gt;5) The InfoPath XML document will be saved to the Sharepoint Document Libray.&lt;BR&gt;6) Biztalk will pick up the XML document from Sharepoint and process it.&lt;BR&gt;7) Optionally&amp;nbsp;Biztalk could post the same or another XML document back up to Sharepoint. &lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Scott Woodgate ( &lt;A href="http://blogs.msdn.com/scottwoo"&gt;http://blogs.msdn.com/scottwoo&lt;/A&gt; ) was absolutely correct in saying that -&amp;gt; What Outlook is to Exchange Server , &lt;BR&gt;InfoPath is to Biztalk 2004. InfoPath provides a human interface to Biztalk Server.&lt;BR&gt;As for Sharepoint,&amp;nbsp;it is and will continue to be a very popular product.&lt;BR&gt;Mainly because of its powerful configuration properties and I love it because it &lt;BR&gt;integrates seamlessly with InfoPath and Biztalk 2004.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=500" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author></entry><entry><title>Setting focus back to the control that caused the PostBack in an ASP.NET Form</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2004/05/06/402.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2004/05/06/402.aspx</id><published>2004-05-06T20:15:00Z</published><updated>2004-05-06T20:15:00Z</updated><content type="html">&lt;P&gt;SmartNavigation can be set to&amp;nbsp;true&amp;nbsp;on your&amp;nbsp;ASP.NET webform so that when postbacks occur , the page when rendered back to the browser, will navigate back to the control that caused the postback.&lt;/P&gt;
&lt;P&gt;But SmartNavigation can be problematic especially when dynamically loading controls onto your webform.&lt;/P&gt;
&lt;P&gt;Therefore if you have SmartNavigation turned off = false, below is a piece of code&amp;nbsp;that you can&amp;nbsp;call&amp;nbsp;from your webform &amp;nbsp;that will add javascript to your page, to automatically navigate back to the control that originally caused the postback.&lt;/P&gt;
&lt;P&gt;I tested the code against IE6 and Netscape 7.1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;/// &lt;SUMMARY&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;/// This method will take passed webPage, and find the control that caused the postback. If it finds&lt;BR&gt;&amp;nbsp;&amp;nbsp;/// one it will set javascript on the page to set focus to that control&lt;BR&gt;&amp;nbsp;&amp;nbsp;/// &lt;/SUMMARY&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;/// &lt;PARAM name="webPage"&gt;The web page&lt;/PARAM&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;public void SetFocusPostBackControl(System.Web.UI.Page webPage)&lt;BR&gt;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;string[] ctlPostBack;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;ctlPostBack = webPage.Page.Request.Form.GetValues("__EVENTTARGET");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (ctlPostBack != null &amp;amp;&amp;amp; ctlPostBack.Length &amp;gt; 0)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;string ctlUniqueId; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ctlUniqueId = ctlPostBack[0];&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.Web.UI.Control findControl = webPage.Page.FindControl(ctlUniqueId);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if ((findControl != null) &amp;amp;&amp;amp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(findControl is DropDownList ||&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;findControl is TextBox&amp;nbsp;||&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;findControl is RadioButton ||&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;findControl is RadioButtonList))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;string ctlClientId;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ctlClientId = findControl.ClientID;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;string jScript;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;jScript = "&amp;lt;SCRIPT language=\"javascript\"&amp;gt; document.getElementById('" + ctlClientId + "').focus(); document.getElementById('" &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;+ ctlClientId + "').scrollIntoView(true) &amp;lt;/SCRIPT&amp;gt;";;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;webPage.Page.RegisterStartupScript("focus",jScript );&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=402" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="ASP.NET" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/ASP.NET/default.aspx" /></entry><entry><title>Developing an ASP.NET Framework From a Windows Forms .NET Perspective.</title><link rel="alternate" type="text/html" href="http://blogs.objectsharp.com/blogs/matt/archive/2004/05/02/393.aspx" /><id>http://blogs.objectsharp.com/blogs/matt/archive/2004/05/02/393.aspx</id><published>2004-05-02T18:07:00Z</published><updated>2004-05-02T18:07:00Z</updated><content type="html">&lt;P&gt;A couple of months ago, I had to quickly develop an ASP.NET framework.&lt;BR&gt;I incorporated parts of a Windows .NET framework that I had previously worked on. The basic&lt;BR&gt;premise being that a Windows .NET Form and an ASP.NET WebForm are both event driven  &lt;BR&gt;and have controls such as buttons and dropdowns.&lt;/P&gt;
&lt;P&gt;There were two basic steps in developing this ASP.NET framework.&lt;/P&gt;
&lt;P&gt;1) Creating Ancestor code behind pages for all the code behind pages used in the project:  &lt;/P&gt;
&lt;P&gt;a) public class WebFormBase : System.Web.UI.Page -&gt; For the Web Forms&lt;BR&gt;b) public class WebUserControlBase : System.Web.UI.UserControl   -&gt; For the Web User Controls&lt;BR&gt; &lt;BR&gt;When a Webform or Web UserControl needs to be created, their code behinds inherit from the custom base class:&lt;/P&gt;
&lt;P&gt;public class  OrderWebForm : WebFormBase&lt;BR&gt;public class  ProductWebuserControl : WebUserControlBase&lt;/P&gt;
&lt;P&gt;I think the above is a pretty standard thing to do.&lt;/P&gt;
&lt;P&gt;The only thing I really did a little bit differently was to raise more events up to the descendent pages such as:&lt;/P&gt;
&lt;P&gt;Loading&lt;BR&gt;Load&lt;/P&gt;
&lt;P&gt;Init&lt;BR&gt;Initing&lt;/P&gt;
&lt;P&gt;PreRendering&lt;BR&gt;PreRender&lt;/P&gt;
&lt;P&gt;etc.&lt;/P&gt;
&lt;P&gt;In this way the descendent code has a chance to do some work before and after the code in ancestor.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;2) All server side controls used on a WebForm or Web UserControl are inherited from the standard Microsoft Web Controls, or a third party control:&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;public class MyWebButton : System.Web.UI.WebControls.Button&lt;BR&gt;public class MyWebMenu : Infragistics.Web.UI.UltraWebMenu&lt;BR&gt;etc. etc. As you know there are many more. Hyperlink, Label, DataList etc. &lt;/P&gt;
&lt;P&gt;For this framework thats pretty well it, in a nutshell.&lt;/P&gt;
&lt;P&gt;This has really paid off for the future development work, because server Side controls can now implement custom interfaces, &lt;BR&gt;such as :&lt;BR&gt;ITranslation&lt;BR&gt;IDisable&lt;/P&gt;
&lt;P&gt;Then in the base classes for the code behind for the WebFormBase or the WebUserControlBase, all the code is there to handle translation  of pages to French or English or to disable or enable or disable controls automatically depending on a custom property put on the Web page called Enabled. Other things that have been built into the framework are resource file management, session management, navigation management and a custom help button that launches another browser with some help.&lt;/P&gt;&lt;img src="http://blogs.objectsharp.com/aggbug.aspx?PostID=393" width="1" height="1"&gt;</content><author><name>matt</name><uri>http://blogs.objectsharp.com/members/matt.aspx</uri></author><category term="ASP.NET" scheme="http://blogs.objectsharp.com/blogs/matt/archive/tags/ASP.NET/default.aspx" /></entry></feed>
