Tuesday, January 24, 2012

BizTalk Interview Questions 01

1. X-Path is a navigation language for finding information held in an XML document.
    Uses:  BizTalk uses XPath in - Pipeline Component Configuration and Property Promotion.
              In Orchestration - to retrieve data for Conditional Business Processing or routing of message.
              In MAP: XPath can be used in XSLT Template Functoid or XSLT Functoid to retrieve the Data  from  Input schema element.

 XPath Is Namespace aware
 Namespace alias used in the XPath query can be different from the alias used in the XML Document.

XPath Functoin Used: Looping- For-Each , Conditional checking, String Manipulation
**Xpath enables you to interrogate an XML document and retrieve information to use during processing. This technique is invaluable, when combined with an XPathDocument, it provieds a fast, streaming approach to retrieving data from your XML document without, for example, loading the entire document into memory.

--------------------------------------------
2.          Serializable classes are classes that can have their "Content" dehydrated for later use.  The .NET implementation allows serializable classes to be dehydrated to any form of stream.
Many API's in the .NET Framework use the concept of streams, which represent an abstract view of data by presenting it in a contiguous sequence of bytes that you can read or write. Thus, they isolate you from any underlying data store, such as a file, serial port, or network connection. This is useful because it enables you to write to and read from a variety "stores" using the same application programming Interface (API)
**** Decorate Class with Serializable attribute ****
Using the XmlSerializer to construct XML documents that conform to a given XSD schema is one approach that works well for some scenarios. Other common approaches include loading a "template" XML document and replacing tokens with the required data, or using the XmlWriter class to build the instance document.
The XmlSerializer approach has the advantage that a valid XML Document will be automatically constructed for you thus removing the need to write such code along with compile-time checks to ensure that, for example, you are using the correct data-types for XML elements.
Other approaches typically require details of the schema such as the structure to be encoded within a template XML document or within code that creates a valid document, if the schema is changed you will need to ensure that these are changed.
These are other aspects that you should consider when selecting an approach, such as the required performance, rate of schema change, and ease of programming model and size and complexity of the XML documents that you are creating.
------------------------------------------
3. Serializable Classes and Performance
When you first use the XmlSerializer in your application against a given type, a dynamic class is created and compiled on the fly to represent the serialized class. This has an obvious performance overhead, but it will be cached for subsequent requests.
The Cache is maintained per the common language runtime (CLR) AppDomain, which is fine for application such as BizTalk, as there is by default one AppDomain per BizTalk host. THis means that any orchestration and .NET code will be run within the same AppDomain for all subsequent requests. For other application, where the AppDomain is torn down each time, this may be an issue.
Serializing a .NET class does have an obvious CPU penalty, so bear in mind the size of your class and the frequency with which you serialize classes. Another consideration is "message size".
BizTalk Processes message in a forward-only streaming fashion, for large messages this approach will cause the entire message to be loaded into memory, which is not desirable.
------------------------------------------------------
BizTalk Development and Serializable Classes
Typically, all messages passing into and out of BizTalk are based on an underlying XML schema.
Within BizTalk orchestrations you often need to pass a BizTalk message into C# class libraries for processing. If you Declare the interface to use serializable classes generated from the XML schema underlying the BizTalk message, you can pass this message directly into your class library and have strong-typed representation of your class. Thus, you eliminate any need to use XPath to retrieve data or to use the XmlDocument API.

No comments:

Post a Comment