Tuesday, October 27, 2009

Building a Complete Certificate Scenario With BizTalk Server 2006




I’m working on a BizTalk project where we’re testing the use of security certificates, and
I’ve just had a bear of a time finding thorough walkthroughs of setting this up. It’s barely
mentioned in the available BizTalk books, and while the BizTalk 2004 whitepaper (which
has now been added to the BizTalk 2006 documentation) has some very nice coverage,
it wasn’t exactly what I wanted. So, after much toil (and threats of lighting myself on
fire), I present a step-by-step for building a certificate scenario using test certificates.
I’ve used the .NET Framework tool makecert to build local test certificates. The hardest
part for me was getting the correct series of command line parameters to build the cert
I wanted. I finally put together one that worked:
makecert -r -pe -n “CN=www.seroter.com” -b 02/01/2007 -e 01/01/2036 -eku
1.3.6.1.5.5.7.3.1 -ss my -sr currentuser -sky exchange -sp “Microsoft RSA SChannel
Cryptographic Provider” -sy 12
For a description of the available parameters, check out the MSDN page for makecert.
What this did, was create a (self-signed) certificate, and placed it in my “current user”
personal store.
You can see from the shot here that the certificate’s private key is included.

So first, I exported the private key certificate out. To do this, I selected the certificate,
right-clicked, and chose export. As you can see below, I chose to Yes, export the private
key and created the .pfx file.

Promoting Schemas Properties in BizTalk Server

Promoting Schemas Properties in BizTalk Server
Introduction
A common scenario in a BizTalk solution is to subscribe to a message based on its
content or context and make decisions based on the underlying values. This is known as
content-based routing. In this article, I will cover the principles and techniques to expose
this sort of metadata in BizTalk Server.
Principles of promoting properties
In order to publish metadata associated to a message in BizTalk, we need to promote
some data fields of the message using the property schema mechanism. This task can be
done using two approaches: quick promotion or regular promotion. In addition to data
fields within the message, we can also promote system properties are automatically
promoted in BizTalk. Any promoted properties (from the BizTalk system and from the
messages also known as message context) are available for subscription by BizTalk
objects such as send ports, send port groups and orchestrations.
You can use promoted properties as decision points and routing ways for the messages
inside an orchestration, although this has an overhead because the whole message must
be load to be interrogated. In order to gain in performance, we use in orchestrations
another technique known as distinguished fields which are lighter.
To access a distinguished field, we create a reference to the name of the message, the
name of the record structure and the name of the distinguished field with each named
item separated by a period using the following syntax
MessageName.RecordName.ChieldRecordName.DistinguishedFieldName. Promoted
properties are accessed by creating a reference to the name of the message, the name
of the property schema and the name of the promoted property name using the
following syntax MessageName(PropertySchemaName.PromotedPropertyName).
Getting started with an example
Now we're going to subscribe to a message based on the content of the message. We're
going to use Property Schema items to promote the data fields in the message in order
to set up filter expressions. We have to use any pipeline but PassThruReceive pipeline to
create the message context during the pipeline processing. Once added to the
message context, they can be used by send ports and other BizTalk subscribing items.
Open Visual Studio .NET and create an empty BizTalk project and add the
Customer_Schema.xsd XSD Schema item (see Figure 1).
Figure 1
Then create the schema as shown in Figure 2.
Figure 2
Now let's promote the CustomerID data field by right-clicking and selecting Promote |
Quick Promotion (see Figure 3).
Figure 3
Then you will be asked to add this data field to a property schema and in turn this new
property schema is added to the project. To view all promoted properties, select any
node of the schema and select Promote| Show Promotions option to open the Promote
Properties windows (see Figure 4).
Figure 4
Build and deploy the solution.
Now we're going to configure the solution to route the messages concerning the
underlying content. For example, if a messaging holding the value of the customer id is
greater than or equal to 1 and less than 5, then it will be routed to a directory output1,
and if the value of the customer id is greater than or equal to 5 and less than 10, it will be
routed to the directory output2. In order to configure the solution, open the BizTalk Server
2006 Administration Console and navigate to the Messaging_Schemas node in the
Applications sub-tree. Create a receive location to read the messages.
Now let's create and configure two send ports. See in Figure 5 the configuration for the
Send Port number 1 and in the Figure 6 the configuration for the Send Port number 2.
Figure 5
Figure 6
Conclusion
In this article, I covered the principles and techniques to promote properties in BizTalk
Server 2006 with an illustrative example that you can use as a baseline to apply it for your
own situation.

BIZTALK Interview Questions

General

  1. Does BizTalk 2004/2006 support Synchronous communication?

BizTalk is essentially Asynchronous. It can exhibit some synchronous behavior, if an Orchestration is converted into a web service.

  1. Enumerate the new functoids added BizTalk 2006?

Please refer to this article New functoids in BizTalk 2006

Schemas

  1. What is the difference between a Document Schema and a Property Schema?

A document schema is like any regular schema, whereas a Property schema consists of only child elements under a root node.

  1. Can an Envelope schema consist of more than one schema type?

Yes. Technically it is possible.

Messaging

  1. Can a flat file message be processing without a pipeline?

A Pipeline's job is to convert any external format into XML, be it a flat file or EDI or anything else.

  1. Can multiple messages be processed or batched without an envelope schema?

It is possible to process multiple messages, without an envelope.

  1. What is property promotion, why is it required?

When a property is promoted, it is exposed to the orchestration/send port filters etc.

  1. In which scenarios would use a "promoted property" vs. "distinguished fields"?

The rule here is, if you don’t want the schema element to appear in send port filters/debugging information then make it a distinguished field.

  1. In Biztalk, what does a message type consist of?

A message type consists of the TargetNamespace#RootElement name.

  1. What are un-typed messages, how does one create them?

A message created in BizTalk Orchestration is bound to a schema, this is a typed message. In un-typed messages, the message is bound to System.Xml.XmlDocument instead of a schema.

  1. What is the difference between static, dynamic and direct binding?

Refer to Binding models in BizTalk

  1. How does one enable subscriptions in BizTalk?

A filter on the Send Port is the first step to enable subscriptions in BizTalk.

Orchestrations

  1. How do you prevent occurring of zombies in a Parallel Convoy?

Refer to the article known as "Convoy Deep Drive" on MSDN

  1. What is the difference between a delay shape vs. a listen shape?

A 'Delay' is very much similar to a sleep on the current thread. A 'Listen' shape is used to wait for an incoming resource, with a timeout period.

  1. When you use Call Orchestration shape vs. Start Orchestration shape?

A Call Orchestration returns the control back to the caller. A Start Orchestration shape starts the orchestration in a non-deterministic way.

  1. What is the difference between a "Message Assignment" shape and an "Expression" shape?

A "Message Assignment" shape is used to create a new message and assign values to it. A Expression shape is used to assign values to variables and also write 'if' conditions.

  1. Does BizTalk Orchestrations support recursion?

An Orchestration does NOT support recursion.

  1. What is the purpose of the property "Activate" in a Receive shape?

It is used to invoke a new instance of an Orchestration.

  1. Can an orchestration Start without an Activatable receive?

A Nested Orchestration can be started without an Activatable receive

  1. Is it necessary for all .NET components being called from an Orchestration be Serializable?

Yes it is necessary. There are cases where a .NET component need not be Serializable.

  1. When do we need set the property "Synchronized" = true for a scope?

This needs to be set, when a variable is shared across the branches of a parallel shape.

  1. What is the difference between an Exception block and a Compensation block? is it the equivalent of try-catch-finally?

Refer to HOW To Compensate a Transaction in a BizTalk Orchestration

  1. Is it possible to have a exception block for an Atomic scope? if not why?

Refer to Parallel Branching and Scoping in BizTalk Orchestrations - Advanced Concepts

  1. How does one enable Correlations in BizTalk?

First create a Correlation type and then create an instance of it.

  1. Is it possible to share variables across two branches in a Parallel shape?

Refer to Parallel Branching and Scoping in BizTalk Orchestrations - Advanced Concepts

  1. Does BizTalk automatically compensate a unsuccessful transaction?

Refer to HOW To Compensate a Transaction in a BizTalk Orchestration

  1. What is the main difference between a Long-Running transaction and an Atomic Transaction in BizTalk context?

Refer to HOW To Compensate a Transaction in a BizTalk Orchestration

Architecture and Design

  1. In an Orchestration design, Orchestration "A" calls another Orchestration "B", and vice versa. Is it possible to implement this design?

It is NOT possible, since it forms a cyclic dependency.

  1. List out the three important things to consider while designing a BizTalk orchestration!

The Incoming data format, The Business process and The Outgoing data format.

  1. Enumerate the steps required to deploy an BizTalk solution from one machine to another machine.

Refer to Using the MSI installer wizard for deploying applications created in BizTalk Server 2006

  1. What is BizTalk?

Biztalk is a messaging based integration tool.
Bonus: It consists of several different pieces including Business Processes (Orchestrations), BAM, Rules Engines, and HAT.

  1. What is a Message Type (i.e. BTS.MessageType) and how is it used in BizTalk?

Message Type is a BizTalk System property that is promoted inside a Pipeline. It is made up of Document Name Space # Root Node Name.

  1. What is the default mapping for Auto Mapping?

The default is by structure. This can be change to by node name on the map properties.

  1. How do you call a Non-Serializable .Net helper class inside an Expression Shape?
    • Add a reference to that class.
    • Make sure your Orchestration is Long Running transactional.
    • Add an Atomic scope.
    • Create an Orchestration variable of that class inside the scope.
    • Create an instance on that object inside the scope.
    • Call the method.
    • Bonus: Mention the class must be strongly signed and in the GAC.
  2. What if the class is Serializable?

No transactional Orchestration or Atomic scope is needed.

  1. What does the Value Mapping Functoid do?

Returns the second parameter if the first parameter is true

  1. What is the difference between a distinguished field and a Promoted Property?
    • Distinguished fields are light weight and can only be used inside an Orchestration.
    • Promoted Properties are defined inside a property schema, are tracking in SQL, can be tracked in HAT, and can be used for content based routing.
  2. How do you achieve First-In-First-Out message processing of messages received from multiple sources using an Orchestration?
    • Use a Sequential Convoy to process the messages in the order they are received into the Message Box.
    • Make sure Ordered Delivery is set to true inside the Orchestration Receive Port.
  3. At high level, what do Receive Ports and Orchestration Send Port really do in terms of messaging? What about Send Ports and Orchestration Receive Ports?
    • Receive Ports and Orchestration Send Ports are both publishers.
    • Ports and Orchestration Receive Ports are both subscribers.
  4. When working with Schemas, Maps, Pipelines, and Orchestrations how the projects should be structured?
    • Schemas and Maps in its own project.
    • Or Schemas and Maps together in its own project.
    • Orchestrations in its own project.
    • Pipelines in it own project.
  5. What is direct binding?
    • Direct binding has three types: direct to message box, self correlating, and partner ports.
    • Used to route message between the message box and Orchestrations without using bindings or from one Orchestration to another Orchestration.
  6. What is BAM used for?

BAM is used to monitor business milestones and key metrics in near real-time throughout a process in BizTalk.

  1. What is the Rules Engine?

Rules are used to provide highly efficient, easily changeable business rules evaluation to Business Processes. This allows rules to be changed without rebuilding and redeploying .net assemblies. The Business Rules Engine (BRE) can also be called from any .net component through the API’s

  1. What are Persistence Points and what causes them?
    • Persistence is when the state of a running Orchestration is stored into SQL.
    • It is good enough to know various shape and actions cause persistence. More specifically, it occurs: end of a transactional scope, at a send shape, at a start Orchestration shape, during dehydration, if the system shuts down expectedly or unexpectedly, or the business process suspends or ends.
  2. What group does a user need to belong to in order to submit messages to the message box?

The user needs to be a member of the hot group or isolated host group (assuming a default installation).

  1. What user rights to you need to perform most actions in HAT?
    • BizTalk Server Administrator

When installing Biztalk in a multi-server configuration with a remote SQL and Analysis Services