<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>BizTalk_Mapping</title>
        <link>http://geekswithblogs.net/PsudoKnowledgeBase/category/9096.aspx</link>
        <description>BizTalk_Mapping</description>
        <language>en-CA</language>
        <copyright>Geordie</copyright>
        <managingEditor>Martin.palmer@mjpalmer.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>Conversion of BizTalk Projects to Use the New WCF-SAP Adaptor</title>
            <link>http://geekswithblogs.net/PsudoKnowledgeBase/archive/2011/02/06/conversion-of-biztalk-projects-to-use-the-new-wcf-sap-adaptor.aspx</link>
            <description>&lt;div style="margin: 0cm 0cm 10pt"&gt;We are in the process of upgrading our BizTalk Environment from BizTalk 2006 R2 to BizTalk 2010. The SAP adaptor in BizTalk 2010 is an all new and more powerful WCF-SAP adaptor. When my colleagues tested out the new adaptor they discovered that the format of the data extracted from SAP was not identical to the old adaptor. This is not a big deal if the structure of the messages from SAP is simple. In this case we were receiving the delivery and invoice iDocs. Both these structures are complex especially the delivery document. Over the past few years I have tweaked the delivery mapping to remove bugs from original mapping. The idea of redoing these maps did not appeal and due to the current work load was not even an option. I opted for a rather crude alternative of pulling in the iDoc in the new typed format and then adding a static map at the start of the orchestration to convert the data to the old schema. &lt;/div&gt;
&lt;div style="margin: 0cm 0cm 10pt"&gt;&lt;b&gt;Note&lt;/b&gt; WCF-SAP data formats (on the binding tab of the configuration dialog box is the ‘RecieiveIdocFormat’ field):&lt;/div&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;u&gt;Typed:&lt;/u&gt;  Returns a XML document with the hierarchy represented in XML and all fields being represented by XML tags.&lt;/li&gt;
    &lt;li&gt;&lt;u&gt;RFC:&lt;/u&gt; Returns an XML document with the hierarchy represented in XML but the iDoc lines in flat file format.&lt;/li&gt;
    &lt;li&gt;&lt;u&gt;String:&lt;/u&gt; This returns the iDoc in a format that is closest to the original flat file format but is still wrapped with some top level XML tags. The files also contained some strange characters at the end of each line.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style="margin: 0cm 0cm 10pt"&gt;I started with the invoice document and it was quite straight forward to add the mapping but this is where my problems started. The orchestrations for these documents are dynamic and so require the identity of the partner to be able to correctly configure the orchestration. The partner identity is in the EDI_DC40 segment of the iDoc. In the old project the RECPRN node of the segment was promoted. The code to set a variable to the partner ID was now failing. After lot of head scratching I discovered the problem was due to the addition of Namespaces to the fields in the EDI_DC40 segment. To overcome this I needed to use an xPath query with a Namespace Manager. This had to be done in custom code.&lt;/div&gt;
&lt;div style="margin: 0cm 0cm 10pt"&gt;I now tried to repeat the process with the delivery document. Unfortunately when we tried to get sample typed data from SAP an exception was thrown.&lt;/div&gt;
&lt;div style="line-height: normal"&gt;&lt;i&gt;&lt;span style="font-size: 9pt"&gt;The adapter "WCF-SAP" raised an error message. Details "Microsoft.ServiceModel.Channels.Common.XmlReaderGenerationException: The segment or group definition E2EDKA1001 was not found in the IDoc metadata. The UniqueId of the IDoc type is: IDOCTYP/3/DESADV01/ZASNEXT1/640. For Receive operations, the SAP adapter does not support unreleased segments.&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style="margin: 0cm 0cm 10pt"&gt; &lt;/div&gt;
&lt;div style="margin: 0cm 0cm 10pt"&gt;Our guess is that when the WCF-SAP adaptor tries to down load the data it retrieves a data schema from SAP. For some reason the schema does not match the data. This may be due to the version of SAP we are running or due to a customization. Either way resolving this problem did not look easy.&lt;/div&gt;
&lt;div style="margin: 0cm 0cm 10pt"&gt;When doing some research on this problem I found an article showing me how to get the data from SAP using the WCF-SAP adaptor without any XML tags.&lt;/div&gt;
&lt;div style="margin: 0cm 0cm 10pt"&gt;&lt;a href="http://blogs.msdn.com/b/adapters/archive/2007/10/05/receiving-idocs-getting-the-raw-idoc-data.aspx"&gt;http://blogs.msdn.com/b/adapters/archive/2007/10/05/receiving-idocs-getting-the-raw-idoc-data.aspx&lt;/a&gt;&lt;/div&gt;
&lt;div style="margin: 0cm 0cm 10pt"&gt;&lt;b&gt;Reproduction of Mustansir blog:&lt;/b&gt;&lt;/div&gt;
&lt;div style="line-height: 10.5pt; background: white"&gt;&lt;tt&gt;&lt;i&gt;&lt;span style="color: #333333; font-size: 9pt"&gt;Since the WCF based SAP Adapter is ... well, WCF based, all data flowing in and out of the adapter is encapsulated within a SOAP message. Which means there are those pesky xml tags all over the place. If you want to receive an Idoc from SAP, you can receive it in "Typed" format (in which case each column in each segment of the idoc appears within its own xml tag), or you can receive it in "String" format (in which case there are just 2 xml tags at the top, the raw xml data in string/flat file format, and the 2 closing xml tags).&lt;/span&gt;&lt;/i&gt;&lt;/tt&gt;&lt;/div&gt;
&lt;div style="line-height: 10.5pt; background: white"&gt;&lt;tt&gt;&lt;i&gt;&lt;span style="color: #333333; font-size: 9pt"&gt;In "String" format, an incoming idoc (for ORDERS05, containing 5 data records) would look like:&lt;/span&gt;&lt;/i&gt;&lt;/tt&gt;&lt;/div&gt;
&lt;div style="line-height: 10.5pt; background: white"&gt;&lt;tt&gt;&lt;i&gt;&lt;span style="color: #333333; font-size: 10pt"&gt;&amp;lt;ReceiveIdoc xmlns='http://Microsoft.LobServices.Sap/2007/03/Idoc/'&amp;gt;&amp;lt;idocData&amp;gt;EDI_DC40 8000000000001064985620&lt;br /&gt;
E2EDK01005 800000000000106498500000100000001&lt;br /&gt;
E2EDK14 8000000000001064985000002000000020111000&lt;br /&gt;
E2EDK14 8000000000001064985000003000000020081000&lt;br /&gt;
E2EDK14 80000000000010649850000040000000200710&lt;br /&gt;
E2EDK14 80000000000010649850000050000000200600&amp;lt;/idocData&amp;gt;&amp;lt;/ReceiveIdoc&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;/tt&gt;&lt;/div&gt;
&lt;div style="background: white"&gt;&lt;tt&gt;&lt;i&gt;&lt;span style="color: #333333"&gt;(I have trimmed part of the control record so that it fits cleanly here on one line).&lt;/span&gt;&lt;/i&gt;&lt;/tt&gt;&lt;/div&gt;
&lt;div style="line-height: 10.5pt; background: white"&gt;&lt;tt&gt;&lt;i&gt;&lt;span style="color: #333333; font-size: 9pt"&gt;Now, you're only interested in the IDOC data, and don't care much for the XML tags. It isn't that difficult to write your own pipeline component, or even some logic in the orchestration to remove the tags, right? Well, you don't need to write any extra code at all - the WCF Adapter can help you here!&lt;/span&gt;&lt;/i&gt;&lt;/tt&gt;&lt;/div&gt;
&lt;div style="line-height: 10.5pt; background: white"&gt;&lt;tt&gt;&lt;i&gt;&lt;span style="color: #333333; font-size: 9pt"&gt;During the configuration of your one-way Receive Location using WCF-Custom, navigate to the Messages tab. Under the section "Inbound BizTalk Messge Body", select the "Path" radio button, and:&lt;/span&gt;&lt;/i&gt;&lt;/tt&gt;&lt;/div&gt;
&lt;div style="line-height: 10.5pt; background: white"&gt;&lt;tt&gt;&lt;strong&gt;&lt;i&gt;&lt;span style="color: #333333; font-size: 9pt"&gt;(a)&lt;/span&gt;&lt;/i&gt;&lt;/strong&gt;&lt;i&gt;&lt;span style="color: #333333; font-size: 9pt"&gt; Enter the body path expression as:&lt;br /&gt;
/*[local-name()='ReceiveIdoc']/*[local-name()='idocData']&lt;/span&gt;&lt;/i&gt;&lt;/tt&gt;&lt;/div&gt;
&lt;div style="line-height: 10.5pt; background: white"&gt;&lt;tt&gt;&lt;strong&gt;&lt;i&gt;&lt;span style="color: #333333; font-size: 9pt"&gt;(b)&lt;/span&gt;&lt;/i&gt;&lt;/strong&gt;&lt;i&gt;&lt;span style="color: #333333; font-size: 9pt"&gt; Choose "String" for the Node Encoding.&lt;/span&gt;&lt;/i&gt;&lt;/tt&gt;&lt;/div&gt;
&lt;div style="line-height: 10.5pt; background: white"&gt;&lt;tt&gt;&lt;i&gt;&lt;span style="color: #333333; font-size: 9pt"&gt;What we've done is, used an XPATH to pull out the value of the "idocData" node from the XML. Your Receive Location will now emit text containing only the idoc data. &lt;/span&gt;&lt;/i&gt;&lt;/tt&gt;&lt;/div&gt;
&lt;div style="line-height: 10.5pt; background: white"&gt;&lt;tt&gt;&lt;i&gt;&lt;span style="color: #333333; font-size: 9pt"&gt;You can at this point, for example, put the Flat File Pipeline component to convert the flat text into a different xml format based on some other schema you already have, and receive your version of the xml formatted message in your orchestration.&lt;/span&gt;&lt;/i&gt;&lt;/tt&gt;&lt;/div&gt;
&lt;div style="margin: 0cm 0cm 10pt"&gt; &lt;/div&gt;
&lt;div style="margin: 0cm 0cm 10pt"&gt;This was potentially a much easier solution than adding the static maps to the orchestrations and overcame the issue with ‘Typed’ delivery documents. Not quite so fast…&lt;/div&gt;
&lt;div style="margin: 0cm 0cm 10pt"&gt;Note: When I followed Mustansir’s blog the characters at the end of each line disappeared.&lt;/div&gt;
&lt;div style="margin: 0cm 0cm 10pt"&gt;After configuring the adaptor and passing the iDoc data into the original flat file receive pipelines I was receiving exceptions.&lt;/div&gt;
&lt;div style="line-height: normal"&gt;&lt;i&gt;&lt;span style="font-size: 9pt"&gt;There was a failure executing the receive pipeline: "PAPINETPipelines.DeliveryFlatFileReceive, CustomerIntegration2.PAPINET.Pipelines, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4ca3635fbf092bbb" Source: "Pipeline " Receive Port: "recSAP_Delivery" URI: "D:\CustomerIntegration2\SAP\Delivery\*.xml" Reason: An error occurred when parsing the incoming document: "Unexpected data found while looking for:&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style="line-height: normal"&gt;&lt;i&gt;&lt;span style="font-size: 9pt"&gt;'Z2EDPZ7'&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style="margin: 0cm 0cm 10pt"&gt;&lt;i&gt;&lt;span style="line-height: 115%; font-size: 9pt"&gt;The current definition being parsed is E2EDP07GRP. The stream offset where the error occured is 8859. The line number where the error occured is 23. The column where the error occured is 0.".&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style="margin: 0cm 0cm 10pt"&gt;Although the new flat file looked the same as the old one there was a differences. In the original file all lines in the document were exactly 1064 character long. In the new file all lines were truncated to the last alphanumeric character.&lt;/div&gt;
&lt;div style="margin: 0cm 0cm 10pt"&gt;The final piece of the puzzle was to add a custom pipeline component to pad all the lines to 1064 characters. This component was added to the decode node of the custom delivery and invoice flat file disassembler pipelines.&lt;/div&gt;
&lt;div style="margin: 0cm 0cm 10pt"&gt;Execute method of the custom pipeline component:&lt;/div&gt;
&lt;div&gt;&lt;span style="line-height: 115%; color: blue; font-size: 9.5pt"&gt;public&lt;/span&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt; &lt;span style="color: #2b91af"&gt;IBaseMessage&lt;/span&gt; Execute(&lt;span style="color: #2b91af"&gt;IPipelineContext&lt;/span&gt; pc, &lt;span style="color: #2b91af"&gt;IBaseMessage&lt;/span&gt; inmsg)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="line-height: 115%; color: green; font-size: 9.5pt"&gt;//Convert Stream to a string&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt"&gt;&lt;span style="line-height: 115%; color: #2b91af; font-size: 9.5pt"&gt;Stream&lt;/span&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt; s = &lt;span style="color: blue"&gt;null&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt"&gt;&lt;span style="line-height: 115%; color: #2b91af; font-size: 9.5pt"&gt;IBaseMessagePart&lt;/span&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt; bodyPart = inmsg.BodyPart;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;span style="line-height: 115%; color: green; font-size: 9.5pt"&gt;// NOTE inmsg.BodyPart.Data is implemented only as a setter in the http adapter API and a&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="line-height: 115%; color: green; font-size: 9.5pt"&gt;//getter and setter for the file adapter. Use GetOriginalDataStream to get data instead.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt"&gt;&lt;span style="line-height: 115%; color: blue; font-size: 9.5pt"&gt;if&lt;/span&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt; (bodyPart != &lt;span style="color: blue"&gt;null&lt;/span&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt; margin: 0cm 0cm 0pt 36pt"&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt;s = bodyPart.GetOriginalDataStream();&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div style="text-indent: 36pt"&gt;&lt;span style="line-height: 115%; color: blue; font-size: 9.5pt"&gt;string&lt;/span&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt; newMsg = &lt;span style="color: blue"&gt;string&lt;/span&gt;.Empty;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt"&gt;&lt;span style="line-height: 115%; color: blue; font-size: 9.5pt"&gt;string&lt;/span&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt; strLine;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt"&gt;&lt;span style="line-height: 115%; color: blue; font-size: 9.5pt"&gt;try&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt"&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt; margin: 0cm 0cm 0pt 36pt"&gt;&lt;span style="line-height: 115%; color: #2b91af; font-size: 9.5pt"&gt;StreamReader&lt;/span&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt; sr = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;StreamReader&lt;/span&gt;(s);&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt; margin: 0cm 0cm 0pt 36pt"&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt;strLine = sr.ReadLine();&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt; margin: 0cm 0cm 0pt 72pt"&gt;&lt;span style="line-height: 115%; color: blue; font-size: 9.5pt"&gt;while&lt;/span&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt; (strLine != &lt;span style="color: blue"&gt;null&lt;/span&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt; margin: 0cm 0cm 0pt 72pt"&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt; margin: 0cm 0cm 0pt 72pt"&gt;&lt;span style="line-height: 115%; color: green; font-size: 9.5pt"&gt;//Execute padding code&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt; margin: 0cm 0cm 0pt 108pt"&gt;&lt;span style="line-height: 115%; color: blue; font-size: 9.5pt"&gt;if&lt;/span&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt; (strLine != &lt;span style="color: blue"&gt;null&lt;/span&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt; margin: 0cm 0cm 0pt 144pt"&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt;strLine = strLine.PadRight(1064, &lt;span style="color: #a31515"&gt;' '&lt;/span&gt;) + &lt;span style="color: #a31515"&gt;"\r\n"&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt; margin: 0cm 0cm 0pt 108pt"&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt;newMsg += strLine;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt; margin: 0cm 0cm 0pt 108pt"&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt;strLine = sr.ReadLine();&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt; margin: 0cm 0cm 0pt 72pt"&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt; margin: 0cm 0cm 0pt 72pt"&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt;sr.Close();&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt; margin: 0cm 0cm 0pt 36pt"&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt; margin: 0cm 0cm 0pt 36pt"&gt;&lt;span style="line-height: 115%; color: blue; font-size: 9.5pt"&gt;catch&lt;/span&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt; (&lt;span style="color: #2b91af"&gt;IOException&lt;/span&gt; ex)&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt; margin: 0cm 0cm 0pt 36pt"&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt; margin: 0cm 0cm 0pt 36pt"&gt;&lt;span style="line-height: 115%; color: blue; font-size: 9.5pt"&gt;throw&lt;/span&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Exception&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"Error occured trying to pad the message to 1064 charactors"&lt;/span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt; margin: 0cm 0cm 0pt 36pt"&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;span style="line-height: 115%; color: green; font-size: 9.5pt"&gt;//Convert back to stream and set to Data property&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt"&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt;inmsg.BodyPart.Data = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;MemoryStream&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Encoding&lt;/span&gt;.UTF8.GetBytes(newMsg)); ;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="line-height: 115%; color: green; font-size: 9.5pt"&gt;//reset the position of the stream to zero&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt"&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt;inmsg.BodyPart.Data.Position = 0;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-indent: 36pt"&gt;&lt;span style="line-height: 115%; color: blue; font-size: 9.5pt"&gt;return&lt;/span&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt; inmsg;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="line-height: 115%; font-size: 9.5pt"&gt;}&lt;/span&gt;&lt;/div&gt; &lt;img src="http://geekswithblogs.net/PsudoKnowledgeBase/aggbug/143835.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Geordie</dc:creator>
            <guid>http://geekswithblogs.net/PsudoKnowledgeBase/archive/2011/02/06/conversion-of-biztalk-projects-to-use-the-new-wcf-sap-adaptor.aspx</guid>
            <pubDate>Sun, 06 Feb 2011 18:45:03 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/PsudoKnowledgeBase/comments/143835.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/PsudoKnowledgeBase/archive/2011/02/06/conversion-of-biztalk-projects-to-use-the-new-wcf-sap-adaptor.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/PsudoKnowledgeBase/comments/commentRss/143835.aspx</wfw:commentRss>
        </item>
        <item>
            <title>How to Map the Selection of the First Item in a Collection to the Final Document</title>
            <link>http://geekswithblogs.net/PsudoKnowledgeBase/archive/2009/05/13/how-to-map-the-selection-of-the-first-item-in.aspx</link>
            <description>&lt;p&gt;&lt;font face="Arial"&gt;I recently came across a new mapping problem.  I needed to make sure that the final document only had one address for a paper mill to satisfy the requirement of a standard documentation format (PAPINet).  Usually the product is all made to order but every so often paper may be available from stock that was made in a different mill.  The SAP system providing the information contains information on both mills.  The challenge here was to remove the additional mills and only include the mill data for the first mill.  In this case the mill information is not important as the ID for the paper (TAPI) includes a character that identifies the producing mill.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;My first attempt was to limit the number of occurrences of the Mill element.  BizTalk ignored the limit.&lt;/font&gt;&lt;font face="Arial"&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;img height="402" alt="Tried to limit the number of occurances using the schema.  Unsuccessful" width="523" src="/images/geekswithblogs_net/PsudoKnowledgeBase/Mill Attribute Limit Occurances.JPG" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;
I then tried to use the 'Data Flattening' functoids with an 'Iteration' functoid.  I set the 'Equal' functoid to receive the value from the 'Iteration' functiod and added a constant value of 1 (BizTalk must use 1 base in it's iterations).  When the 'Iteration' functoid equals 1 it will resolve to true allowing the 'Data Flattening' functoids to only process the first occurrence of the Mill attribute.&lt;/p&gt;
&lt;p&gt;&lt;font style="BACKGROUND-COLOR: #ffff00"&gt;&lt;img height="250" alt="Using the iteration functoid to limit the number of occurances" width="687" src="/images/geekswithblogs_net/PsudoKnowledgeBase/Iteration limiting occuances.JPG" /&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;
The overall solution is a complex mapping from SAP to PAPINet.  It uses a canonical structure to assist in the transformation.  This problem was greatly simplified by using the canonical to canonical mapping (added to allow some complex calculations to be preformed). &lt;/p&gt; &lt;img src="http://geekswithblogs.net/PsudoKnowledgeBase/aggbug/132090.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Geordie</dc:creator>
            <guid>http://geekswithblogs.net/PsudoKnowledgeBase/archive/2009/05/13/how-to-map-the-selection-of-the-first-item-in.aspx</guid>
            <pubDate>Wed, 13 May 2009 16:04:57 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/PsudoKnowledgeBase/comments/132090.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/PsudoKnowledgeBase/archive/2009/05/13/how-to-map-the-selection-of-the-first-item-in.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/PsudoKnowledgeBase/comments/commentRss/132090.aspx</wfw:commentRss>
        </item>
        <item>
            <title>How to block the creation of parent nodes when using the data flattening functoid</title>
            <link>http://geekswithblogs.net/PsudoKnowledgeBase/archive/2009/03/12/how-to-block-the-creation-of-parent-nodes-when-using.aspx</link>
            <description>&lt;p&gt;&lt;font face="Arial"&gt;I've had a few BizTalk maps that have caused me to stop and think as to how to get over the problem of suppressing nodes when the child node has no data.  The issue arises if you use Data flattening shape to block the creation of an element. The child node is suppressed but the parent node is still created.  I just found out how to block the parent node from being created so I’m posting it here so I can find it again the next time I need it.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;&lt;img height="362" alt="Suppressing parent nodes" width="887" src="/images/geekswithblogs_net/PsudoKnowledgeBase/BizTalkSuppressNodeMapping.JPG" /&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;By connecting the parent nodes to the functoid that provides the condition to the data flattening functoids the parent nodes will be suppressed.&lt;/p&gt;
&lt;p&gt;Thanks to &lt;span id="ctl00_plcHolder_Main_dlistSections_ctl00_lblCategoryHeading"&gt;&lt;a href="http://blogs.digitaldeposit.net/saravana/post/2007/05/18/BizTalk-Map-Suppress-Element-if-Attribute-is-not-required.aspx"&gt;Saravana Kumar&lt;/a&gt;&lt;/span&gt; for posting the answer on his blog.&lt;/p&gt;
&lt;p&gt;Geordie&lt;/p&gt; &lt;img src="http://geekswithblogs.net/PsudoKnowledgeBase/aggbug/130048.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Geordie</dc:creator>
            <guid>http://geekswithblogs.net/PsudoKnowledgeBase/archive/2009/03/12/how-to-block-the-creation-of-parent-nodes-when-using.aspx</guid>
            <pubDate>Thu, 12 Mar 2009 20:17:27 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/PsudoKnowledgeBase/comments/130048.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/PsudoKnowledgeBase/archive/2009/03/12/how-to-block-the-creation-of-parent-nodes-when-using.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/PsudoKnowledgeBase/comments/commentRss/130048.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Installing custom functoids</title>
            <link>http://geekswithblogs.net/PsudoKnowledgeBase/archive/2009/01/21/installing-custom-functoids.aspx</link>
            <description>&lt;p&gt;I just got bit by this one a second time.  So it is time to store the information here to avoid a third occurrence.&lt;/p&gt;
&lt;p&gt;If you get an exception that the functoid was not found.&lt;/p&gt;
&lt;pre&gt;For example:- 'Exception Caught: Functoid not found:
guid({5DE500CC-45BC-454b-A23D-24449899042C})  funcid(6123)'&lt;/pre&gt;
&lt;p&gt;Check that the dll is installed in the mapper extension folder '&lt;font face="Arial"&gt;C:\Program Files\Microsoft BizTalk Server 2006\Developer Tools\Mapper Extensions&lt;/font&gt;' as well as the GAC.&lt;/p&gt;
&lt;p&gt;Geordie&lt;/p&gt; &lt;img src="http://geekswithblogs.net/PsudoKnowledgeBase/aggbug/128875.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Geordie</dc:creator>
            <guid>http://geekswithblogs.net/PsudoKnowledgeBase/archive/2009/01/21/installing-custom-functoids.aspx</guid>
            <pubDate>Wed, 21 Jan 2009 22:46:51 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/PsudoKnowledgeBase/comments/128875.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/PsudoKnowledgeBase/archive/2009/01/21/installing-custom-functoids.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/PsudoKnowledgeBase/comments/commentRss/128875.aspx</wfw:commentRss>
        </item>
        <item>
            <title>XTransformationFailureException: encountered while executing the transform…</title>
            <link>http://geekswithblogs.net/PsudoKnowledgeBase/archive/2008/12/02/xtransformationfailureexception-encountered-while-executing-the-transform.aspx</link>
            <description>&lt;div style="MARGIN: 0cm 0cm 10pt"&gt;I recently encounter this error. It took a little bit of head scratching to work out why we were getting the error. The possible causes were quite high as we are using dynamically assigned maps (see code below).&lt;/div&gt;
&lt;div style="MARGIN: 0cm 0cm 10pt"&gt;&lt;strong&gt;&lt;u&gt;Message Assignment Shape Code&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0cm 0cm 10pt"&gt;
&lt;table cellspacing="1" cellpadding="1" width="80%" align="left" summary="" border="0"&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td&gt;           &lt;/td&gt;
            &lt;td&gt;&lt;font face="Arial"&gt;SapOrderMapType = System.Type.GetType(SapOrdersMapName);&lt;/font&gt;
            &lt;p&gt;//transform(MyOutputMsg) = MyMapType(MyInputMsg);&lt;/p&gt;
            &lt;p&gt;transform (SapOrder) = SapOrderMapType(CanonicalPO);&lt;/p&gt;
            &lt;p&gt;System.Diagnostics.Trace.WriteLineIf(TraceEnabled, "Transform to SAP schema complete.", TraceCategory);&lt;/p&gt;
            &lt;p&gt;SapOrder(FILE.ReceivedFileName) = "PO_" + CustomerNumber + "_" + PONumber + "_";&lt;/p&gt;
            &lt;p&gt;System.Diagnostics.Trace.WriteLineIf(TraceEnabled, "SAP Order Msg Created", TraceCategory);&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;The error information identifies the transform as the problem but not what the problem is. The inner exception is no additional help- ‘Value cannot be null. Parameter name: extension Exception type: ArgumentNullException’.&lt;/p&gt;
&lt;div style="MARGIN: 0cm 0cm 10pt"&gt;The problem was eventually tracked down to the custom functoids. In the last map a new functoid was added to convert standard BizTalk dates into standard SAP dates. When the project was deployed the custom functoid dll was not updated.&lt;/div&gt;
&lt;div style="MARGIN: 0cm 0cm 10pt"&gt;Interestingly this error might occur intermittently as the functiod may not be needed every time the map is used.&lt;/div&gt; &lt;img src="http://geekswithblogs.net/PsudoKnowledgeBase/aggbug/127545.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Geordie</dc:creator>
            <guid>http://geekswithblogs.net/PsudoKnowledgeBase/archive/2008/12/02/xtransformationfailureexception-encountered-while-executing-the-transform.aspx</guid>
            <pubDate>Wed, 03 Dec 2008 04:00:49 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/PsudoKnowledgeBase/comments/127545.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/PsudoKnowledgeBase/archive/2008/12/02/xtransformationfailureexception-encountered-while-executing-the-transform.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/PsudoKnowledgeBase/comments/commentRss/127545.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>
