Search This Blog

Wednesday 13 October 2010

BizTalk Tips & Tricks

In this article you can find some of the tips & tricks ,best practices learned and applied during my career experience.I hope readers will find them useful and I am happy to get any comment/feedback & objections on any of my posting.Thanks & Happy BizTalking.

1. BizTalk Best Practices

Always use multipart messages in Orchestration
o    If schema changes (replacing with new schema), no need to change the orchestration send/receive.
o    Practical approach – if the schema is changed, delete the part from the multipart message. Lot of time saved. No needs to touch receive/send shapes & receive/send logical port.
·         Always use Direct Binding
o    Messages are always processed using subscriptions. So, how does it matter?
o    Loosely coupling.
o    Reusable orchestrations
·         Always use Canonical Schema (Separate Internal & External Schemas)
o    One single canonical schema can have everything in it .Ex: Order schema can have all the order details at one place. Anybody and everybody can refer to the same schema to pull out any data.
o    Flexible. If partner schema changes, only corresponding Map needs change. Orchestration unaffected.
o    Generic Orchestrations can be created with canonical schema.
·         Always Deploy at Solution Level in VS ,rather than project Level
o    Automatic build/deploy of dependencies.
·         Always use straight forward Maps either in Receive/Send port. Only if there are multi level input/output mappings and message constructions are needed within the orchestration.
o    No need to update Orchestration, if schema   changes.
o    Alternative - ESB (dynamic mapping -My personal choice)
·         Never expose Orchestration as Web/WCF service. Always expose schemas to the caller
o    Loosely coupling
o    Changing orchestration without breaking the caller.

·         Always use relative paths for Config & Key files
o    Avoids source control build issues!
o    Practically – relative path “../” means one folder up, generally from the bin folder or in BizTalk bin/development folder.
·         Debug XSLT used in Maps separately using VS Debugger.
o    Maps are not debugger friendly
o    Input can be validated against the mapping rules and helps to fix any mapping error prior to deployment.



2. Some useful BizTalk Tips


To Debug XSLT
·         Validate the Map
·         Open the xslt generated from the validate map (generally in C:\Users\<Porifle>\AppData\Local\Temp\_MapData\ folder)
·         Right click – View source
·         Set Break points
·         Set input XML document, which you want to use to validate the Map, in the properties
·         set the output XML path. This will be result generated once the debug is complete.
·         Menu – XML – Debug XSLT
·         Verify the output document – check you have got everything u needed.
·         If any error, you will be shown them in the Output window.
·         That’s it done.

Direct Binding Orchestration

My Ideal way of creating Orchestrations.
·         Receive shape direct binding message box
·         Send shape in direct binding message box
·         Receive shape can have filters – such as Receive Port/Location Name or any other promoted properties
·         Send port can have filters such as Message Type

    3.Useful Information on BizTalk  

Schema versioning

·         Multiple versions of the same schema (same message type = root node +namespace & same dll name, but different version such as 1.0.0.0 /2.0.0.0) can be deployed in the same server .But; the latest version will be picked up by the BizTalk.

MinOccurs vs. Nillable (Optional vs. Not Required)
·         Optional -field doesn’t need to be present in the XML.
·         Required
·         Not Optional
·         Not Required - field doesn’t need to have a value.
Possible combinations:
·         Optional + Not Required
·         Optional + Required
·         Not Optional + Not Required
·         Not Optional + Required
MinOccurs = 0 means optional.
Nillable = “true” means not required.

String data types are Nillable by default
Other types – integer, bool, date, time etc are required by default – to make it not required set Nillable = “true”

BizTalk Orchestration Profiler – tool to get the coverage on the orchestration tracking. Used to identify long running shapes, low latency issues .gives number of instances run over a period of time and the coverage at shape level.
BizTalk Documenter – Tool to create documents in chm /word format with the BizTalk artefacts details in the assembly.
XSDObjectGen.msi – Generates .NET class of schema equalent.similar to xsd.exe.

4.BizTalk – Don’ts

·         using XmlDocument in custom pipeline component . XmlDocument consumes more memory.Use streaming instead.
·         using external schema directly in internal mapping & processing . maintain equivalent internal schema will reduce lot of rework even if the external schema undergo changes.