Ravindar, Biztalk Developer and Administrator

Just another BizTalk blog

Testing multi part message map in BizTalk

There are instances where you want to test a map  with multipart input message (more than one input message).

the usual approach is to do a test map and take the auto generated sample file, edit it with required data. This is really a tedious task.

There is a nice tool developed by Tomasso to easily select the sample files and create a merged message and execute map from the tool

we can download the tool from

https://code.msdn.microsoft.com/Execute-BizTalk-2013-maps-e8db7f9e

and also refer following

http://www.ithero.nl/post/2013/06/19/Extension-functions-cannot-return-null-values-Exception-when-running-a-map-in-BizTalk-2013.aspx

 

Advertisements

September 15, 2017 Posted by | Uncategorized | Leave a comment

Working with boolean or non-string variables passing to c# method from BizTalk map

The rule here is all the variables inside the BizTalk map are string variables (even if it’s date or boolean or any other).

you would need to explicitly convert them back to there original types before you can use them in the methods.

 

for example

if you are passing a boolean variable to a method and the c# method signature is like below with the parameter type defined as bool


public static string MyMethod(bool isEligible)

 

in this case, the c# method will always recieve the isEligible parameter value as true (even if it’s value is sent as false from BizTalk map).

 

this is because, Biztalk map always operates on string variables, and in this case, when it sends the value “false” to this c# method, and since the method signature defines the variable as type bool, it will just check if the object exists and since the object always exists(as you are passing it), the value of isEligible parameter will always gets set to true.

 

so, in order to make it behave as we want, we need to define the parameter type as string like below


public static string MyMethod(string isEligible)

 

and before using it, you need to explicitly convert it to the bool type


bool convertBoolisEligible = System.Convert.ToBoolean(isEligible);

 

September 14, 2017 Posted by | Uncategorized | Leave a comment

Constructing a Biztalk Message without Construct shape

As mentioned in the following url

https://maximelabelle.wordpress.com/2010/06/17/creating-biztalk-messages-using-inline-xlangs-statements/

you can construct a message without using a construct shape


construct OutboundMessage {

XmlDocument.LoadXml(
@"<?xml version='1.0' standalone='yes' ?>
<Root id='012345' xmlns='http://schemas.sample.org/BizTalk/2010/input' />
");

OutboundMessage = XmlDocument;
}

 

 

September 11, 2017 Posted by | Uncategorized | Leave a comment

Limitations of making dateTime field as distinguished in BizTalk

I came across an issue related to DateTime conversion yesterday. The Datetime was coming 10hours ahead than expected. Although the value was being passed correctly , it was receiving 10hours ahead time and this revealed a strange behaviour of BizTalk while assigning dateTime fields.

 

The root issue was the DateTime field was a distinguished filed and when the value is being assigned in orchestration, it automatically converts to UTC But the Time zone is lost. In this case, BizTalk does not behave as expected, although you pass local time, when the value is assigned to a distinguished datetime filed.

 

The behaviour is clearly elaborated  here  http://www.malgreve.net/2012/10/03/datetime-xml-element-converted-to-utc-how-to-read-the-original-time-of-a-different-time-zone/

In c# it will work fine, but in Biztalk Orchestration if we assign value to distinguished dateTime field, the Time zone will be lost.

 

Ultimately to read the correct value, we had to use the method DateTime.SpecifyKind(param1, DateTimeKind.Local);   to get the correct time.

 

So firstly it’s good to avoid making the datetime fields as distinguished, otherwise if it is mandatory to make a datetime filed as distinguished, please keep this limitation in mind and use the above method to get the desired output.

August 30, 2017 Posted by | Uncategorized | Leave a comment

System.InvalidOperationException: Text cannot be written outside the root element

I was  working with SOAP UI and i copied text to the mock service response and the Biztalk WCF send port started giving the error “System.InvalidOperationException: Text cannot be written outside the root element”

it’s due to the white spaces in the response message.

 

the fix for it to continue your work locally is , on the send port set the Body path expression value as “/*” as shown

 

WCF port ignore white spaces

August 25, 2017 Posted by | Uncategorized | Leave a comment

Biztalk Tracking data not visible

TrackingData table rows count should usually be close to 0.

but if we see huge count here, it means there is an issue with Tracking host.

SELECT COUNT(*) FROM [BizTalkMsgBoxDb].[dbo].[TrackingData]

create a new host, create a corresponding new host instance and remove the old ones. This should fix the issue

https://jeremiedevillard.wordpress.com/2011/07/01/no-data-in-the-tracked-services-instances-of-the-biztalk-administration-console/

http://www.manuelmeyer.net/2012/03/enable-biztalk-trackingthe-message-was-not-found-in-the-message-box-or-the-tracking-database/

August 17, 2017 Posted by | Uncategorized | Leave a comment

Octopus variable not identifying HTML content

You should define your variable in settings file generator like
#{variable name here | HtmlEscape}

so you should add the escaping character

August 10, 2017 Posted by | Uncategorized | Leave a comment

Purpose of each tables in BiztalkMgmtDb

https://social.technet.microsoft.com/wiki/contents/articles/22940.biztalkmgmtdb-all-table-details.aspx

June 26, 2017 Posted by | Uncategorized | Leave a comment

Loop through a set of variables or set of elements

To loop through a set of specific variable values


<xsl:for-each select="$var1 | $var2 | $var3 ">
<xsl:if test=".!=''">   (to test if the varirable value is not null)

<xsl:value-of select="."/>
<xsl:if test="not(position() = last())">,</xsl:if>   (to avoid last comma)
</xsl:if>

</xsl:for-each>

 

 if you want to loop through a set of node values

<xsl:for-each select="element1Xpath/text() | Element2Xpath/text()| ElementNxpath/text()">
        <xsl:value-of select="."/>
        <xsl:if test="not(position() = last())">,</xsl:if>
      </xsl:for-each>

June 11, 2017 Posted by | Uncategorized | Leave a comment

DanSharp Xml viewer

DanSharp is a another tool to test your xpath queries

https://dansharpxmlviewer.codeplex.com/

June 9, 2017 Posted by | Uncategorized | Leave a comment