Wednesday, November 4, 2009

BizTalk Architecture

Introduction


I have heard they ask "How would you explain Excel (any product) to your grandmother?" in many companies; a question popularized by Microsoft, I believe. First, I am not so sure my grandma would understand any technology product so easily. Also, I am not sure if this is a good question to ask a software developer; maybe, to someone from sales, yes! On the record, I must say that my grandmother is an incredibly smart lady. So the question really boils down to "How you would make an IT common man understand what a product is all about?" This is what I am trying to endeavor in this article.
Sometime back, I had to explain to a group of non-IT folks about BizTalk Server. You know the people who wouldn't understand all these geeky terms like SOA, XML, SOAP, or Orchestrations (pardon me, she says she knows about SOAP!). I thought I'd share my experience here in this article for the benefit of the CodeProject community. This article is aimed at you if you have heard about this wonderful thing called BizTalk Server, and want to understand what it is clearly before diving into the marketing material which seems to be the same for every product - the "panacea" of all your problems.

Drawing a Parallel

BizTalk Server is Microsoft's enterprise application integration solution, with built-in support for XML and SOAP. It offers integration with Visual Studio .NET, and provides speed, reliability, and flexibility for standards-based enterprise application integration. An analogy they say is "Similarity in some respects between things that are otherwise dissimilar". So for me, to explain BizTalk, I would start off with an analogy. In the section below, I am comparing BizTalk Server to a Customs facility.

The Customs Facility




What we have in the figure above is a Customs facility. We have an Import Terminal through which a large number of packages come in by different modes of transport: planes, ships, buses, trucks, barges. These packages then go through a standard inspection process, with several stages including identifying the package, unpacking the contents, and then identifying the shipper. The packages then go to a central store. From there, customs inspection of the packages takes place. The process could be different for different types of packages, and there is a "Customs Inspection Rules and Regulations Manual" which details the inspection process, and which in practice, gets updated from time to time. After a package passes the inspection process, it is sent back to the central store, from where it is packaged and sent to the correct destination.

The BizTalk Server Architecture





The figure above is the architecture of a BizTalk Server messaging subsystem. As you will notice, this figure is same as the previous figure except for the labeling. Here, instead of packages moving, we have XML messages that are moving. The files come in through Receive Ports and are passed to the "Message Box" through a "Receive Pipeline". They are then picked up by "BizTalk Orchestrations" and are processed. Custom rules maybe loaded and executed at this point. They are then send out using a Receive Pipeline through a "Send Port" to the destination.

Receive Ports

The Receive Ports are how messages come into BizTalk. Messages can come into BizTalk by any means of transport like HTTP, SOAP, SQL, file, EDI; just like the way packages arrive via planes, ships, buses, or trucks. How they are transported does not change how they are processed later. This is a very powerful feature because it gives you the ability to change the transport type and the source of the data even after your application is deployed, without changing your application implementation. For instance, let us say some sales related data is coming in from a shared "FILE" folder in Europe connected via WAN today, tomorrow you can configure it as an FTP pickup from a remote server from India, or probably accept it as an HTTP request over the web posted from a browser.

Adaptors

Adaptors are the BizTalk way of handling additional transport. Just like you can have a private plane fly your package in, you can write your own adaptor for a custom transport, like say POP3. So there is always scope for buying or writing your own custom adaptor to integrate with all the other available transports. For instance, you can have a DB2 adaptor or a SAP adaptor.

Receive Pipeline

The Receive Pipeline contains different mechanisms like "Decoding" (if encoded), "Disassembling" (if there are multiple parts), and "Party Resolution". This is similar to the unpacking and identifying the sender, in our example. Just like we have an express lane for certain packages, there is a "Pass Through" pipeline facility in BizTalk which is essential a smooth transfer to the Message Box. Just like you can have special handling instructions for certain packages, you can write custom pipeline components using the framework.

Message Box and Subscriptions

The BizTalk Message Box lies in the heart of the BizTalk messaging subsystem; this is like our central store. This message box is, in fact, realized as a SQL Store; so this way, BizTalk ensures reliability for your messages in terms of guaranteed delivery. Even if a node in BizTalk fails, the message will be picked up by another node in the farm. BizTalk also ensures that it does not delete the file from a pickup folder location while using file/any transport, unless it is persisted completely in SQL. Well, this also means you need to have a fault tolerant SQL Server architecture. Just like we will be noting down a few important details while we unpack the packages, in the pipeline, certain properties are promoted into the context, like transport information: the most important of these being the incoming XMLSchema#RootNode. The BizTalk Publish-Subscribe mechanism identifies which Orchestrations subscribe to that particular message, based on this promoted information, and routes it accordingly.

Orchestrations

Orchestrations are processes that are defined in the Business Process Execution Language (BPEL). This could be something like, say: if quantity is greater than threshold, apply discount, else standard discount. At this stage, you can also change the format of the message using Transformation Maps, or you can call some other web service to do an operation like credit card verification. This is like our example in which we have the customs inspection process and checking with the bank if the excise payment is cleared.

Business Rules Engine

Business Rules Engine is used by BizTalk to load the current policies which are a collection of Rules from the Orchestration. These rules are kept separately as these could change from time to time. In our example above, this would be something like, during Olympics there could be certain relaxations in guidelines or certain promotions in effect. These change from time to time, and they are kept separate. This is the idea behind the Rule Store in BizTalk.

Send Pipeline

The "Send Pipelines" are just the opposite of the "Receive Pipelines" and they do operations like "Encoding" the message, or "Assembling" or "Signing" the message. This is like packing and sealing a package before we send it. Just like we have different types of packaging like bubble wrapping and cushion mailers, there could be different pipeline components at this stage.

Send Ports

Send Ports also handle transport like receive ports, but their direction is the reverse. Here, the message direction is from the Message Box to the destination. Send Ports can subscribe to a message directly from the Message Box, without passing through the orchestration. This is like having a package coming in from a certain shipper which has a prior clearance attached with it. This is called Content Based Routing (CBR).






Friday, October 30, 2009

Sharepoint Tools

I have tried to summarise the list of development tools that you require on your day to day development. Please post your comment, if I miss anything here.

* App Pool Manager (http://www.harbar.net/apm/apm2.zip)
* U2U CAML Query Builder (http://www.u2u.info/SharePoint/U2U%20Community%20Tools/U2U%20Caml%20Query%20Builder%202007%20v3.1.0.0%20(windows%20version).zip)
* .NET Reflector (http://reflector.red-gate.com/download.aspx)
* SharePoint Explorer for WSS 3.0 ( )
* SharePoint Log Reader (http://www.blogaboutsharepoint.com/wp-content/plugins/download-monitor/download.php?id=1)
* BDC Meta Man Tool (http://www.lightningtools.com/pages/service/customerdownloads.aspx)
* SharePoint Inspector 1.0.0.0 (http://spi.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=1652#DownloadId=5854)
* SharePoint Explorer for WSS 3.0 (http://download.mondosoft.com/Ontolica/SharePointExplorer_V1_5_1_For_WSS3.zip)
* SharePoint Dispose Checker Tool (http://download.microsoft.com/download/B/4/D/B4D279A0-E159-40BF-A5E8-F49ABDBE95C7/SPDisposeCheck.msi)
* Windows SharePoint Services 3.0 SDK (http://www.microsoft.com/downloads/details.aspx?familyid=05E0DD12-8394-402B-8936-A07FE8AFAFFD&displaylang=en)
* Microsoft Office SharePoint Server 2007 SDK (http://www.microsoft.com/downloads/details.aspx?familyid=6D94E307-67D9-41AC-B2D6-0074D6286FA9&displaylang=en)
* Microsoft InfoPath 2007
* Microsoft SharePoint Designer 2007
* Microsoft Office 2007
* WSP Builder for SharePoint (http://www.codeplex.com/wspbuilder)
* Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions (http://www.microsoft.com/downloads/details.aspx?FamilyID=3e1dcccd-1cca-433a-bb4d-97b96bf7ab63&DisplayLang=en)
* Windows SharePoint Services 3.0 Tools: Visual Studio 2008 Extensions (http://www.microsoft.com/downloads/details.aspx?familyid=7BF65B28-06E2-4E87-9BAD-086E32185E68&displaylang=en)
* SharePoint Administration Toolkit v2.0
x64: http://www.microsoft.com/downloads/details.aspx?FamilyId=F8EEA8F0-FA30-4C10-ABC9-217EEACEC9CE&displaylang=en
x86: http://www.microsoft.com/downloads/details.aspx?FamilyId=263CD480-F6EB-4FA3-9F2E-2D47618505F2&displaylang=en
* SmartPart (http://www.codeplex.com/smartpart)
* SharePoint Installer (http://www.codeplex.com/sharepointinstaller)
* SOAP calls to the SharePoint web services (http://www.soapui.org/)

Saturday, October 24, 2009

Classes Vs Modules

Both classes and modules are reference types that encapsulate items defined within, but they differ in how these items are accessed from other procedures.
The primary difference between classes and modules is that classes can be instantiated and standard modules cannot. Because there is never more than one copy of a standard module's data, when one part of your program changes a public variable in a standard module, any other part of the program gets the same value if it subsequently reads that variable. Class data, on the other hand, exists separately for each instantiated object. Another difference is that unlike standard modules, classes can implement interfaces.
Classes and modules also employ different scope for their members. Members defined within a class are scoped within a specific instance of the class, and exist only for the lifetime of the object. The practical result is that, to access class members from outside a class, you must use only fully qualified names; for example, Object.Member. Members declared within a standard module, on the other hand, are shared by default, and are scoped to the declaration space of the standard module's containing namespace. This means that public variables in a standard module are effectively global variables because they are visible from anywhere in your project, and they exist for the life of the program. Unlike class members, members of standard modules are implicitly shared and cannot use the Shared keyword.

Tuesday, October 20, 2009

Difference between Physical Architecture and Logical Architecture

When most people talk about n-tier applications, they’re talking about physical models in which
the application is spread across multiple machines with different functions: a client, a web server, an
application server, a database server, and so on. And this isn’t a misconception—these are indeed
n-tier systems. The problem is that many people tend to assume there’s a one-to-one relationship
between the layers (tiers) in a logical model and the tiers in a physical model, when in fact that’s not
always true.

A physical n-tier architecture is quite different from a logical n-layer architecture. An n-layer
architecture has nothing to do with the number of machines or network hops involved in running
the application. Rather, a logical architecture is all about separating different types of functionality.
The most common logical separation is into an Interface layer, a Business layer, and a Data layer.
These may exist on a single machine or on three separate machines—the logical architecture doesn’t
define those details.

Monday, October 19, 2009

Use Client-Side JavaScript to Disable ASP.NET Validators


This came up this week on a project I am working on and now it will transcend to other projects.  I needed to rewrite some functionality utilizing client-side code.  Well, I could've done it server-side but I'm not a fan of unnecessary postbacks (or UpdatePanel"partial postbacks") so I decided to utilize JavaScript.
So I removed all the AutoPostBack="true"'s from the codebase and utilized my favorite property (Control.ClientID) to set the css display style to "none" or "" depending on which option was selected.  After all that was done I decided to test. Uh-oh, myRequiredFieldValidators were firing off since I was only using CSS* to hide / unhide myPanels. Instead of adding values to these controls to satisfy the expressions (which doesn't work all of the time (i.e. input type='file' or asp:FileUpload which don't allow the setting of a posted file as it is a security risk). I found out how to turn off validation.  It only took a little bit to add via codebehind.cs.
For this example, I have a CheckBox for checks that when clicked needs to disable aRequiredFieldValidator for CreditCard.  Stupid example I know.
check.Attributes.Add("onclick"string.Format("disable('{0}')", regexCreditCard.ClientID)); 
That will add the appropriate handler for client-side work. Now that that is out of the way, time for the actual disabling of the validator.
function disable(validatorId)
{
   
var validator = document.getElementById(validatorId);
   ValidatorEnable(validator, 
false);

Easy. Now you can use .NET to implement tamper-proof validation and disable / enable via JavaScript for a richer user experience.
* Using "display: none" is much better than simply using "visibility: hidden" for what's it's worth (at least it was for me).  With "visibility: hidden" you can tell that something issupposed to be there. With "display: none" you can't.  So in summary, "visibility: hidden" results in the page calculating this div as part of the flow.  With "display: none", it's not even accounted for.  It's as if it were never there!

Saturday, October 17, 2009

Microsoft's Live Framework

Microsoft is now positioning the Live Framework as the development framework for all of Microsoft’s Live services, not just Live Mesh. The Live Framework is akin to the .Net Framework, but is aimed to support developers writing mostly consumer-focused applications and services that need online/offline synchronization and work across the PC, Web and devices.

Here at Microsoft Professional Developer Conference (PDC), Microsoft announced that its Live Framework is now “live,” as in Microsoft allowing developers to sign up to test drive it.

Microsoft also made some tweaks to the framework since it first unveiled plans for it. Some of the names of the different subsystems within the framework are different. And the way that Live Mesh and Silver light work together has been fleshed out. The Framework now includes support for contacts, so that developers can build applications that will be designed to spread vi-rally.

We’re unleashing (contacts) in the platform. We’re making social-graph information available to developers to help them make their applications viral,” said Jeff Hansen, General Manager Services Marketing.

Here’s what the Live Framework looked like in April:

And here’s what the Live Framework looks like now:


The infrastructure services layer, even though it’s not visible in the newly revised slide, remains the same: It’s Windows Azure (Red Dog) and the building-block Azure services. The Mesh FX (framework) is now simply called the “programming model.” The Mesh operating environment  is now the Live Operating Environment. The operating environment consists of three pillars: Data, applications and communications.

“We want to make it easy for rich applications to extend to the cloud. But we also want to help Web apps break free of the browser frame and go offline,” explained Abhay Parasnis, General Manager of Live Mesh. “We also want to enable developers of applications inject social-graph data into their applications.”

Developers are going to be able to wrap a Silver-light application with an “invisible” Internet Explorer wrapper and publish an application to Mesh. Through the Mesh synchronization model, developers can enable their applications to run locally on any Mesh-enabled system or device. When users reconnect and go online, these local Silverlight apps will automatically synchronize.

So what’s next for Mesh? Microsoft will be moving more of its Live services onto the base Red Dog cloud operating system, officials said. Right now, Live Mesh is the first of those services that is (partially) hosted in Microsoft’s cloud. Microsoft also will continue to extend its base Live Services platform. Right now, that platform consists of shared identity; directory; communication and presence; search and geospatial; and contacts. Expect Live Workspace, groups, calendars and other core elements to be added to the platform in the coming months.

Microsoft vs Google

Regardless of whether you’re in the Google camp or in the Microsoft camp, I think it’s a fair statement to say that these differences of viewpoint accurately reflect each company’s core strength and focus: Google wants the browser to grow to subsume the desktop; Microsoft wants the desktop to grow to subsume the cloud.

Monday, September 28, 2009

Google Wave A New Kind of Mega-Application

Google's newly unveiled Wave may be called a communication and collaboration tool, but it's much more than that. Wave combines key Web trends from the last couple of years into one elegant application. And it may make today's enterprise tools such as Microsoft SharePoint look ridiculously complicated.

Read Further : Google Wave Application

Friday, September 25, 2009

Dark Side Of UpdatePanel


The UpdatePanel function ASP.Net for Ajax provides the robust support for easy web navigation tool. Ajax is a great thing when it comes to interaction and user experience but you will be overdoing your website when you place everything in the UpdatePanel.

UpdatePanel is a great tool for an Ajax based development but it does not mean you have to use it whenever you have the chance. A simple HTML or the simplified version of Ajax will prove useful while maintaining simplicity and efficiency.
Placing the web content in the UpdatePanel will mean every time information is requested, the UpdatePanel will get in touch with the XMLHttpRequest which in turns builds an HTTP Post. After that the ASP.Net builds the page class using the ViewState that we created in the HTTP POST. After ViewState a parser is made for the specific part of the webpage which will also run through the lifecycle. After it parses, the DOM is eventually updated displaying the webpage.

The Problem recently I face while working with updatepanel in the ASP.net page is  that, it is not going to postback at all while performing an event on the page. After digging out i come to know, is due to, I put a onsubmit ( JavaScript ) script on the Form (Server Side)tag and it stops the partial page postback. After removing that script element ( onsubmit='javascript') from Form tag, Page Post back is ok. A snippet is attached to view.