Wednesday, April 6, 2016

For-each usage with Looping, Conditional and Value Mapping Functoids in BizTalk

In one requirement client requested to develop destination schema having specific output format.

Problem : xsl:for-each statment to be put at the parent field of destination schema while using the Looping, Conditional and Value Mapping Functoids

Solution : When you use a Looping, Conditional functoid, or a Value Mapping functoid, an xsl:for-each statement is generated in the compiled map. If the child field of the destination schema has unbounded maximum occurrences, the xsl:for-each statement is put at the child field. If the child field does not have unbounded maximum occurrences, the xsl:for-each statement is put at the parent field of the child field.

However, because the location of the xsl:for-each statement affects the map result, you may want the xsl:for-each statement to be put at the child field of the destination schema, regardless of whether the maximum occurrence of the child field is set to 1.

You can control the placement of the xsl:for-each statement by modifying the value of the TreatElementsAsRecords attribute in the map (.btm) file

     Syntax : <mapsource TreatElementsAsRecords="Yes" ></mapsource>


When this attribute is set to Yes, the xsl:for-each statement is put at the child field of the destination schema, regardless of whether the maximum occurrence of the child field is set to 1.

Hope this Helps!!!

Evalute Itinerary Performance in BizTalk

In one of the requirement client have requested to have evalution of Itinerary Performance from development stand point.

Problem : how can we track itinerary performance with ESB Toolkit

Solution : out of the box ESB Toolkit have capability to track the Itinerary with predefined performance counters

ItineraryBeginTime
ItineraryEndTime

ItineraryState
MessageDirection
ServiceType
ServiceisRequestResponse
ServiceState
ItineraryName
ESBServiceName

here from this we can concentrate only on (ItineraryBeginTime, ItineraryEndTime, ItineraryState) this performance counters available in BAMPrimaryImport database.

There is a step in ESB Toolkit installation where one need to deploy Itinerary Services BAM defination as given in below steps

C:\Program Files (x86)\Microsoft BizTalk Server 2010\Tracking>bm deploy-all -Def
initionFile:"C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit 2.1\Bam\Micros
oft.BizTalk.ESB.BAM.Itinerary.xml"


Once you run above command you can see several tables bam_ItineraryServiceActivity in BAMPrimaryImport database.

now in Itinerary Designer for shape where we need to enable tracking we can achive the same by setting the Tracking Enabled="True" option.



In BAMPrimaryImport database we have table called bam_ItineraryServiceActivity_Completed we can utilize the ItinearryBeginTime and ItineraryEndTime column to take the difference in Seconds/NanoSeconds for messages and take average of same and calculate average time taken, highest time taken and lowest time taken to process the message using Itinerary.

Here is the example:

SELECT DATEDIFF(NS,ItineraryBeginTime,ItineraryEndTime) FROM [BAMPrimaryImport].[dbo].[bam_ItineraryServiceActivity_Completed]

Hope this Helps!!!

Execute custom command with Deployment Framework (BTDF) in BizTalk

Some time back one requirement came to me to run some custom command execution using the Deployment Framework or BTDF.

Problem : any way, where in we can keep an orchestration in the unenlisted state using BTDF

Solution : above requirement can be fulfill with two approches

1) we can keep the property  State="Unenlisted" in PortBindingsMaster.xml file for orchestration which you wanted to keep unenlisted, but make sure StartApplication set to false.

2) using WMI script we can Unenlist the orchestration post the successful deployment using the BTDF

In Target we can create one custom Target which run post deployment in BTDF, following is the sample,

<target name="CustomTargetDeploy">
    <Exec Command="my_command_to_execute" />
</target>

instead of text "my_command_to_execute" we can write our own command like (rename, copy, del etc.) we can also call the batch file as well, following is the command line arguments for Unenlisting the orchestration.


 cscript.exe "c:\Program Files (x86)\Microsoft BizTalk Server 2010\SDK\Samples\Admin\WMI\Stop Orchestration\VBScript\StopOrch.vbs" "myNameSpaceName.OrchestrationName" "myAppName" Unenlist

we need to save above command as OrchUnenlist.bat then call this in Custom Targest.



Hope this Helps!!!

Tuesday, April 5, 2016

ItineraryState does not updating with 'Complete' status in BizTalk

I have got one of the requirement wherein i have to analyze the performance of Itinerary. like how much time overall an Itinerary can take.

Problem: Itinerary status does not updates with 'Complete' even though Itinerary flow is completed.

Solution : Whenever you face such issues first checkpoint that you need to look at is see if you have configured the right pipeline on your send port(static or dynamic) and make sure you have selected the Microsoft.Practices.ESB pipelines like ItinerarySend or ItinerarySendPassThrough or any of your custom pipeline having the Dispatcher component.




Hope this helps!!!
 

Monday, April 4, 2016

Word Casing check in BizTalk BRE

I got one reuirement where in I will have any case type of word as an input and i have to put if condition on that word in BizTalk BRE.


Problem : from input schema element value can be come in any casing format(Upper case, Lower case, Camel case)

input schema element should be checked using the BizTalk BRE if statment

Solution : Out of box BizTalk supports Match predicate which checks the elements with regular experssion matches with the left hand oprand.

Predicate : Match

Regular Expression : (?i)vikas\b


Input Schema :

<ns0:PO xmlns:ns0="http://POSchemas.PO">
<POName>vikas</POName>
<PONum>PO_12</PONum>
<POAmount>0</POAmount>
<PODate>2011-01-01</PODate>
<Items>
<ItemName>Screw</ItemName>
<ItemQty>5</ItemQty>
<UnitPrice>2.1</UnitPrice>
<ItemSum>1.2</ItemSum>
</Items>
</ns0:PO>


Test Result :

CONDITION EVALUATION TEST (MATCH) 4/4/2016 4:10:11 AM
Rule Engine Instance Identifier: 5d772604-6224-4e40-8455-656f09ab4807
Ruleset Name: LowerCaseCheck
Test Expression: True == Match(TypedXmlDocument:POSchemas.PO:/PO.POName, (?i)vikas\b)
Left Operand Value: True
Right Operand Value: True
Test Result: True

Hope this will Helps!!!!


Regards,