Okay, so I needed to have a value to set the agreement. According to the documentation it states in step 3:

If step 2 does not succeed, resolves the agreement by matching the party name in the message context properties with the DestinationPartyName property, which is set as additional agreement resolver in the Identifiers tab of agreement properties.

Here is the correct Identifiers screen that needs to be populated.



So I feel I am gifted!

Truly GIFTED (oh and humble to boot)

I am gifted at discovering ways to break BizTalk.

Last night I had to re-design a process that is run in an itinerary. Now I have gotten into the mindset that executing the transform for all of the endpoints before consuming into BizTalk is far more efficient than executing 6 maps along the path through the business process. This means that I end up with a ‘collection’ of messages that I slice off the particular message I need and send it out.

My design pattern is that I have a generic xml document that runs through the ESB and then I extract the message I need, assign it to another xml document, and send it on its way.

The code that I am using in the message assignment is something like this:

RequestMsg = xpath(OriginalCanonicalMsg,”/Request/Part/SingleReqest”);

The problem is that when I change the message I am sending out from XmlDocument to a multipart message instead, the message assignment shape does not turn red.

I deploy it and it runs and shows up in the ESB Portal stating the error that it must have an implementation of Add(System.Object) at all levels of their inheritance hierarchy for RequestMsg.

It was just working!?

The code that I needed to change was:

RequestMsg.MessagePart = xpath(OriginalCanonicalMsg,”/Request/Part/SingleReqest”);

Viola, works now…


So I needed to fill a value up to 24 characters. I decided to do a bit of research so I could hold my own to my brother Brian (who currently holds the title at Stott Creations as the XSL king).

I have never used xsl:call-template nor recursion.

Here is an example of how to do this:

<?xml-stylesheet type="text/xsl" href="padding.xsl"?> <!--The most important is the <xsl:call-template>--> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output indent="yes"/> <xsl:template match="/"> <XML> <Example> <xsl:attribute name="Instance"> <xsl:text>1</xsl:text> </xsl:attribute> <Title>Padding zeros at the end of A435 into a 6 byte field</Title> <Value> <xsl:call-template name="startpadding"> <xsl:with-param name="padChar" select="'0'"/> <xsl:with-param name="padCount" select="6"/> <xsl:with-param name="actualvalue" select="'A435'" /> <xsl:with-param name="justification" select="'left'" /> </xsl:call-template> </Value> </Example> <Example> <xsl:attribute name="Instance"> <xsl:text>2</xsl:text> </xsl:attribute> <xsl:variable name="pad_tmp_1"> <xsl:call-template name="startpadding"> <xsl:with-param name="padCount" select="40"/> <xsl:with-param name ="padChar" select="'#'" /> <xsl:with-param name="actualvalue" select="'Look ma, spaces:'" /> <xsl:with-param name="justification" select="'left'" /> </xsl:call-template> </xsl:variable> <xsl:variable name="pad1" select="translate($pad_tmp_1,'#',' ')"/> <Title>Dealing with spaces with a 40 character field (left justified)</Title> <Value> <xsl:value-of select="$pad1"/> </Value> </Example> <Example> <xsl:attribute name="Instance"> <xsl:text>3</xsl:text> </xsl:attribute> <xsl:variable name="pad_tmp_2"> <xsl:call-template name="startpadding"> <xsl:with-param name="padCount" select="40"/> <xsl:with-param name ="padChar" select="'#'" /> <xsl:with-param name="actualvalue" select="'...and then there is text'" /> <xsl:with-param name="justification" select="'right'" /> </xsl:call-template> </xsl:variable> <xsl:variable name="pad2" select="translate($pad_tmp_2,'#',' ')"/> <Title>Dealing with spaces with a 40 character field (right justified)</Title> <Value> <xsl:value-of select="$pad2"/> </Value> </Example> </XML> </xsl:template> <xsl:template name="startpadding"> <xsl:param name="padChar" select="'#'"/> <xsl:param name="padCount" select="0"/> <xsl:param name="actualvalue" select="0"/> <xsl:param name="justification" select="left" /> <xsl:choose> <xsl:when test="$justification='left'"> <xsl:value-of select="$actualvalue"/> <xsl:variable name="valuelength"> <xsl:value-of select="string-length($actualvalue)"/> </xsl:variable> <xsl:if test="$valuelength &lt; $padCount"> <xsl:call-template name="pad"> <xsl:with-param name="padChar" select="$padChar" /> <xsl:with-param name="padCount" select="$padCount - $valuelength" /> </xsl:call-template> </xsl:if> </xsl:when> <xsl:otherwise> <xsl:variable name="valuelength"> <xsl:value-of select="string-length($actualvalue)"/> </xsl:variable> <xsl:if test="$valuelength &lt; $padCount"> <xsl:call-template name="pad"> <xsl:with-param name="padChar" select="$padChar" /> <xsl:with-param name="padCount" select="$padCount - $valuelength" /> </xsl:call-template> </xsl:if> <xsl:value-of select="$actualvalue"/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="pad"> <xsl:param name="padChar" select="'#'"/> <xsl:param name="padCount" select="0"/> <xsl:value-of select="$padChar"/> <xsl:if test="$padCount&gt;1"> <xsl:call-template name="pad"> <xsl:with-param name="padCount" select="number($padCount) - 1"/> <xsl:with-param name="padChar" select="$padChar"/> </xsl:call-template> </xsl:if> </xsl:template> </xsl:stylesheet>

Which returns this:

<?xml version="1.0" encoding="utf-8"?> <XML> <Example Instance="1"> <Title>Padding zeros at the end of A435 into a 6 byte field</Title> <Value>A43500</Value> </Example> <Example Instance="2"> <Title>Dealing with spaces with a 40 character field (left justified)</Title> <Value>Look ma, spaces: </Value> </Example> <Example Instance="3"> <Title>Dealing with spaces with a 40 character field (right justified)</Title> <Value> ...and then there is text</Value> </Example> </XML>

Sep 142012

So this is the first blog post from my phone!
I decided that I might as well find out what diagnosis pointers are (I am rewriting an inbound claim process right now also).
To keep things simple and less EDI’ish we will use the following example.
CLAIM diagnosis codes: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
SERVICE: 2, 5, 7
SERVICE: 1, 2, 3, 12
SERVICE: 10, 13

Depending on the claim type, you can have quite a few diagnosis’
The first one listed however is the primary diagnosis code.
Each service line can have 1 up to 4 diagnosis code pointers.
So it really is a many-to-many relationship.

Jul 032012

So I finally sat down and decided to figure out what all of the numbers are for the DelimiterSetSerializedData attribute in the X12InterchangeXml rood node.

<ins0:X12InterchangeXml DelimiterSetSerializedData="126:13:10:42:58:-1:-1:-1:-1" xmlns:ins0="http://schemas.microsoft.com/BizTalk/EDI/X12/2006/InterchangeXML">

Ascii Table

So the values are for the

  • segment delimiter:126+13+10=~<CR><LF>
  • element delimiter:42=*
  • sub-element delimiter:58=:

If there aren’t any values, you simply need to put –1 in the stream, example

<ins0:X12InterchangeXml DelimiterSetSerializedData="126:-1:-1:42:58:-1:-1:-1:-1" xmlns:ins0="http://schemas.microsoft.com/BizTalk/EDI/X12/2006/InterchangeXML">


So I was working with a co-worker over the past week or so creating the following process:


Each trading partner (including the same one who got two) receives an interchange of EDI 835 payment advices.

So he had created the map and was getting the interchange xml output out of the orchestration where the map lives. However, every time he would attempt to send it through the EDI send pipeline, it would dehydrate stating that the object reference not set to an instance of an object. I searched high and low (and by that I mean that I went to multiple pages in my Google search).

So my co-worker had taken a day off and I was going ‘supposed’ to work on it. I was working on a few other things and knew that I wouldn’t get to it. The night before he took the day off, I knew exactly what the problem was, and I ended up having to think about the fix for an entire 36 hours (torture).

Resolution: We had created a partner specific 835 schema with a target namespace of http://schema.company.com instead of http://schema.microsoft.com. We had even gone into the agreement settings and set the schema from http://schema.microsoft.com to http://schema.company.com. His map was creating (via pure xsl) the interchange message with the transaction’s namespace set to http://schema.microsoft.com. Well, when the EDI assembler received the xml version of the transactions, it went to the GAC to find the 835 schema with the target namespace of http://schema.microsoft.com (this object is referencing), however, we didn’t have the default 835 schema deployed. This meant that the EDI assembler was referencing an instance of an object. (It didn’t lie after all). Once we changed the map to create transactions with the target namespace with http://schema.company.com did it run through without fail.

Now we have a process that runs in seconds, no batching, maintains the order of claim payment advices by order of the Header record.

Update: not only does this apply to when the EDI assembler can’t find the appropriate schema, if your transformation is creating nodes in the xml document that are not found in the schema representing the EDI document, it will throw the same error. If you know that you have deployed the correct schema, then it means that you should go back and unit test your map.

Apr 262012

Have you ever needed to query through the BizTalk Management Console and find some messages that are tracked, but the console keeps timing out?

Here is a query that you can run:

use [BizTalkDTADb] GO set DEADLOCK_PRIORITY LOW SELECT TOP 1000 ms.strStatus AS [Event Type], svcs.strServiceName AS [Service Name], tr.strAdapter AS [Adapter], mioe.strUrl AS [URI], sn.strSchemaName AS [Schema Name], po.strPortName AS [Port Name], DATEADD(MI, DATEDIFF(MI,GETUTCDATE(),GETDATE()), mioe.dtTimestamp) AS [Timestamp], mioe.nPartCount AS [Part Count], mioe.nMessageSize AS [Size], ds.strDecryptionSubject AS [Decryption Certificate], ss.strSigningSubject AS [Signature], pn.strPartyName AS [Party Name], mioe.uidActivityId AS [Activity ID], mioe.uidMessageInstanceId AS [Message Instance ID], mioe.uidServiceInstanceId AS [Service Instance ID], si.uidServiceClassId AS [Service Class ID], svcs.strServiceType AS [Service Class] FROM dta_SchemaName sn JOIN [dbo].[dta_MessageInOutEvents] mioe ON mioe.nSchemaId = sn.nSchemaId LEFT JOIN [dbo].[dta_Adapter] tr ON tr.nAdapterId = mioe.nAdapterId LEFT JOIN [dbo].[dta_MessageStatus] ms ON mioe.nStatus = ms.nMessageStatusId LEFT JOIN [dbo].[dta_DecryptionSubject] ds ON ds.nDecryptionSubjectId = mioe.nDecryptionSubjectId LEFT JOIN [dbo].[dta_SigningSubject] ss ON ss.nSigningSubjectId = mioe.nSigningSubjectId LEFT JOIN [dbo].[dta_PartyName] pn ON pn.nPartyId = mioe.nPartyId LEFT JOIN [dbo].[dta_ServiceInstances] si ON mioe.uidServiceInstanceId = si.uidServiceInstanceId AND mioe.uidActivityId = si.uidActivityId LEFT JOIN [dbo].[dta_Services] svcs ON si.uidServiceId = svcs.uidServiceId LEFT JOIN [dbo].[dta_PortName] po ON po.nPortId = mioe.nPortId --Put the port name that you want to look at here: WHERE CAST(po.strPortName AS nvarchar(4000)) = 'Meditech Port' ORDER BY mioe.dtTimestamp DESC

Did I tell you that you should not be doing this? YOU SHOULDN’T!!!!!


How do you query BAMArchive data? The tables that are created are time stamped.
A friend asked me about this, so I thought I would put a little example out there for everyone to see.
With the BAMarchive, all of the columns are the same (for a particular activity), so all I really need to do is UNION ALL the data.
(Oh this query has to be run against the database that the tables live)

use BAMArchive GO --Create all of the tables create table Table_1 (data nvarchar(100)) GO create table Table_2 (data nvarchar(100)) GO create table Table_3 (data nvarchar(100)) GO create table Table_4 (data nvarchar(100)) GO --Insert some data into each table insert into Table_1 select 'data for table 1' insert into Table_2 select 'data for table 2' insert into Table_3 select 'data for table 3' insert into Table_4 select 'data fro table 4' --Here is the actual work declare @statement nvarchar(max) set @statement='' select @statement=@statement+'select data from '+ name +' union all ' from sys.tables --Only get the tables that were created within the past day --but here you would want to include the activity name where create_date > dateadd(d,-1,GETDATE()) --Remove the last union all set @statement=substring(@statement,0,len(@statement)-9) --Show the query we are about to run select @statement [Query] --Actually run the statement exec (@statement) --dropping tables so you can run the query again drop table Table_1 GO drop table Table_2 GO drop table Table_3 GO drop table Table_4 GO


I am writing this as a personal reminder on how to watch a BRE rule fire in BizTalk.

In the management console, go to the application you are working in and right click the policies and in the window click refresh.

Right click and and add and choose the policies you want to track.

Here are the various policies that I have been debugging:


(Yes, I know, I can set the endpoint configuration correctly on the first try (see my hints page), but I can’t determine the map to call to save my life!)

Restart the Host Instances

Run the process though and look at the Tracked Service Instances,  right click on the Message Flow


Click on the Follow this link to view the Policy execution details for this Orchestration Instance.



Apr 182012

So I was attempting to debug an XSL stylesheet and every time I attempted to debug it, I would continually get the following error:

Visual Studio encountered an error and will restart.

I looked high and low, to no avail.

The solution(s) are (one or the other)

  • Disable Visual Studio 2010 Power Tools
  • Move the xsl into a c# project instead of a BizTalk project
© 2013 BizTalk Blog Suffusion theme by Sayontan Sinha