Sending messages between different applications is a necessary part of solving the problems that BizTalk Server 2004 addresses. Yet in most cases, it is only a means to an end. The real goal is to define and execute business processes based on these applications. The BizTalk Server 2004 engine provides two technologies for doing this: orchestration and the Business Rule Engine. This section describes both.
Orchestration
You can implement a business process directly in a language such as C# or Microsoft Visual Basic® .NET. However, creating, maintaining, and managing complex business processes in conventional programming languages can be challenging. Just as important, a process created in this way is likely to act as a set of disparate applications rather than as a coherent business process. Like its predecessors, then, BizTalk Server 2004 does not take this approach. Instead, it enables you to create a business process graphically. Doing this can be faster than building the process directly in a programming language, and it can make the process easier to understand, explain, and change. Business processes built in this fashion can also be monitored more easily, a fact that is exploited by the Business Activity Monitoring (BAM) technology described later in this document.
Successfully creating an automated business process usually requires collaboration between technology-oriented developers and less-technical business people. Accordingly, BizTalk Server 2004 provides appropriate tools for each. The developer tools run inside Visual Studio .NET, an environment in which software professionals feel at home. Most business people do not find Visual Studio especially inviting, however, so BizTalk Server 2004 also provides a subset of the developer tool functionality in the Orchestration Designer for Business Analysts (ODBA), an add-in for Microsoft Visio. Information created in the ODBA tool can be imported into the Visual Studio-based tools and vice-versa, which helps developers and business analysts work together when creating a business process. After it exists, this process, known as an orchestration, is automatically transformed into standard assemblies that run on the .NET Framework.
Note |
|---|
|
Orchestrations were called schedules in BizTalk Server 2000 and BizTalk Server 2002.
|
A developer relies on three primary tools for creating an orchestration: BizTalk Editor for creating XML schemas, BizTalk Mapper for defining translations between those schemas, and Orchestration Designer for specifying the flow of business processes. Unlike earlier versions of the product, all of the developer tools in BizTalk Server 2004 are hosted inside Visual Studio .NET, providing a consistent environment. This section describes what each of these tools does and how they work together.
Creating Schemas: BizTalk Editor
Orchestration works with XML documents, each of which conforms to some XML schema. Accordingly, there must be a way to define these schemas. To do this, the BizTalk Server 2004 engine provides BizTalk Editor. This tool enables you to use the XML Schema definition language (XSD) to create schemas, which are essentially definitions of the types and structure of the information in a document. While BizTalk Editor is not new with this release, this complete reliance on standard XSD is. Because the final Worldwide Web Consortium (W3C) standard for XSD was not complete when they were developed, previous versions of BizTalk Server used XML Data Reduced (XDR), a Microsoft-specific language for defining schemas. Now that XSD has been finalized, BizTalk Server 2004 relies on this standard approach for describing the structure of XML documents.
Creating raw XSD schemas without some tool support is not simple. To make this necessary step more approachable, BizTalk Editor enables its user—probably a developer—to build a schema by defining its elements in a graphical hierarchy. Existing schemas can also be imported from either files or accessible Web services. However they are acquired, schemas are used as the basis for BizTalk maps, which are described next.
Mapping Between Schemas: BizTalk Mapper
An orchestration implementing a business process typically receives some documents and sends others. It is common for part of the information in the received documents to be transferred to the sent documents, perhaps transformed in some way. For example, an order fulfillment process might receive an order for some number of items, and then send back an acknowledgment indicating that the order was sent. It is possible that information from the order, such as the name and address of the purchaser, might be copied from fields in the received order into fields in the order acknowledgment. You can use BizTalk Mapper to define a transformation—a map—from one document to the other.
To the developer creating it, each map is expressed as a graphical correlation between two XML schemas that defines a relationship between elements in those schemas. The W3C has defined the Extensible Stylesheet Language Transformation (XSLT) as a standard way to express these kinds of transformations between XML schemas; therefore, as in previous versions of BizTalk Server, maps in BizTalk Server 2004 are implemented as XSLT transformations.
The transformation defined in a map can be simple, such as copying a name and address from one document to another. Direct data copies like this are expressed by using a link, which is shown in BizTalk Mapper as a line connecting the appropriate elements in the source schema with their counterparts in the destination schema. More complex transformations are also possible by using functoids. A functoid is a chunk of executable code that can define arbitrarily complex mappings between XML schemas, and BizTalk Mapper represents it as a box on the line connecting the elements being transformed. Because some of those transformations are fairly common, BizTalk Server 2004 includes a number of built-in functoids. These built-in functoids are grouped into categories that include the following:
-
Mathematical functoids. Perform operations such as adding, multiplying, and dividing the values of fields in the source document and storing the result in a field in the target document.
-
Conversion functoids. Convert a numeric value to its ASCII equivalent and vice-versa.
-
Logical functoids. Used to determine whether an element or attribute should be created in the target document based on a logical comparison between specified values in the source document. Those values can be compared for equality, greater than/less than, and in other ways.
-
Cumulative functoids. Compute averages, sums, or other values from various fields in the source document, and then store the result in a single field in the target document.
-
Database functoids. Access information stored in a database.
You can create custom functoids directly in XSLT or by using .NET languages like C# and Visual Basic .NET. (Earlier versions of BizTalk Server used Visual Basic Scripting Edition (VBScript) or Microsoft JScript® to create custom functoids, and you may need to modify maps that use these to work with BizTalk Server 2004.) Functoids can also be combined in sequences, cascading the output of one into the input of another.
Having a way to define the XML schema of a document is essential, as is a mechanism for mapping information across documents with different schemas. BizTalk Editor and BizTalk Mapper address these two functions. Yet defining schemas and maps is not enough. You must also specify the business process that will use the schemas and invoke the maps. How this is done is described next.
Defining Business Processes: Orchestration Designer
A business process is a set of actions that together meet some useful business need. With the BizTalk Server 2004 engine, you can use Orchestration Designer to define these actions graphically. This tool enables you to create an orchestration by connecting a series of shapes in a logical way, rather than expressing the steps in a programming language. Some of the most commonly used shapes are:
Receive. Enables the orchestration to receive messages. A Receive shape can have a filter that defines exactly what kinds of messages should be received, and it can be configured to start a new instance of an orchestration when a new message arrives.
Send. Enables the orchestration to send messages.
Port. Defines how messages are transmitted. Each instance of a Port shape is connected to either a Send or Receive shape. Each port also has a type, which defines things such as what kinds of messages this port can receive; a direction, such as send or receive; and a binding, which determines how a message is sent or received by, for example, specifying a particular URL and other information.
Decide. Represents an if-then-else statement that allows an orchestration to perform different tasks based on Boolean conditions. You can use the Expression Editor, part of Orchestration Designer, to specify this conditional statement.
Loop. Enables performing an action repeatedly while some condition is true.
Construct Message. Enables building a message.
Transform. Enables transferring information from one document to another, transforming it on the way by invoking maps defined with BizTalk Mapper.
Parallel Actions. Enables specifying that multiple operations should be performed in parallel rather than in sequence. The shape that follows this one will not be executed until all of the parallel actions have completed.
Scope. Enables grouping operations into transactions and defining exception handlers for error handling. Both traditional atomic transactions and long-running transactions are supported. Unlike atomic transactions, long-running transactions rely on compensating logic rather than rollback to handle unexpected events.
Message Assignment. Enables assigning values to orchestration variables. These variables can be used to store state information used by the orchestration, such as a message being created or a character string.
After you have defined a business process in this way, the group of shapes and relations between them is converted into the Microsoft intermediate language (MSIL) that is used by the .NET Framework common language runtime (CLR). Ultimately, the group of shapes that you define in BizTalk Server 2004 becomes just a standard .NET assembly. And of course, you can still add explicit code to an orchestration when necessary by calling a COM or .NET object from inside a shape.
Additional Orchestration Support
The rise of Web services is having an impact on how business processes are defined. For example, think about the case where two organizations interact by using Web services. To interoperate effectively, it might be necessary for each side of the interaction to know something about the business process the other is using. If both organizations use BizTalk Server 2004, this is not a big problem; tools such as the Trading Partner Management technology described later in this document can be used to distribute this knowledge. But what if the organizations use different software? What if one organization uses BizTalk Server 2004 and the other uses software from another vendor? For cases like this, it is useful to have a way to describe the business process interactions in a cross-vendor way.
To support this type of interaction, Microsoft, IBM, and others have created Business Process Execution Language (BPEL). A business process defined by using Orchestration Designer can be exported to BPEL, and BizTalk Server 2004 can also import processes defined in BPEL. While the language is useful for describing and sharing the external-facing parts of a business process between trading partners, it is important to realize that BPEL is not focused on cross-platform execution of business processes. It is also important to understand that BPEL is built entirely on Web services, while BizTalk Server 2004 and other products that support this language provide a broader set of services. For example, BizTalk Server 2004 provides support for mapping between different XML schemas, calling methods in local objects, executing transactions, and other features that are not available in BPEL.
Web services enable applications to exchange XML documents through SOAP, and they have had a big impact on integration platforms. Unlike previous versions of the product, BizTalk Server 2004 has built-in support for Web services. To access an external Web service, the creator of an orchestration can use the Add Web Reference option in Visual Studio .NET along with the SOAP adapter to directly invoke operations, just as with any other .NET assembly. Similarly, BizTalk Server 2004 provides the Web Services Publishing Wizard that can generate an ASP.NET Web service project exposing one or more of operations of an orchestration as SOAP-callable Web services. These two options enable you to both access existing Web services from within a business process and expose the functionality of an orchestration as a Web service to other business processes.
Like the other developer tools provided by BizTalk Server 2004, Orchestration Designer runs inside Visual Studio .NET. In some cases, however, a business analyst rather than a developer may wish to graphically define business processes. Because business analysts may not be comfortable using Visual Studio .NET, BizTalk Server 2004 also includes the Orchestration Designer for the Business Analyst (ODBA) tool, an add-in for Microsoft Visio that enables you to define a business process and then import that process into Orchestration Designer.
Orchestrations are the fundamental mechanism for creating business processes in BizTalk Server 2004. Some aspects of an orchestration tend to change more often than others, however. In particular, the decisions embedded in a business process—the business rules—are commonly its most volatile aspect. The spending limit for a manager was $100,000 last week, but a promotion bumps this up to $500,000, or the maximum allowed order for a slow-paying customer decreases from 100 units to only 10. Why not provide an explicit way to specify and update these rules? This is exactly what the Business Rule Engine does, as described next.
Business Rule Engine
Orchestration Designer, together with BizTalk Editor and BizTalk Mapper, is an effective way to define a business process and the rules it uses. It is sometimes useful, though, to have an easier way to define and change business rules. To allow this, BizTalk Server 2004 provides the Business Rule Engine to enable more business-oriented users to directly create and modify sets of business rules. These rules are created by using a tool called the Business Rule Composer, and then executed directly by the engine. This technology is new in BizTalk Server 2004, and it is one of the most interesting features in the product.
To see why this approach is useful, think about what is required to change a business rule that is implemented within an orchestration. A developer must first open the orchestration in Visual Studio .NET, modify the appropriate shapes (and perhaps the .NET or COM objects they invoke), and then build and deploy the modified assembly. If instead this business rule is implemented by using the Business Rule Engine, it can be modified without recompiling or restarting anything. All that is needed is to use the Business Rule Composer to change the desired rule, and then redeploy the new set of rules. The change takes effect immediately. And while orchestrations are typically created and maintained by developers, business rules are readable enough to be modified by business analysts without the need to involve more technical people.
When you create a set of business rules, you typically begin by using the Business Rule Composer to define a vocabulary for use in specifying those rules. Each term in the vocabulary provides a user-friendly name for some information. For example, a vocabulary might define terms such as Number Shipped or Maximum Quantity of Items or Approval Limit. Each of these terms can be set to a constant or be mapped to a particular element or attribute in some XML schema (and thus in an incoming message), or to the result of an SQL query against some database, or even to a value in a .NET object.
Note |
|---|
|
You can also use XML element and attribute names directly in definitions of business rules, so creating a vocabulary is not strictly required. It just makes business rules easier to create and understand, especially if business analysts are doing this rather than developers.
|
After you have defined a vocabulary, you can use the Business Rule Composer to create business policies that use the vocabulary. Each policy can contain one or more business rules. A rule uses the terms defined in some vocabulary together with logical operators such as Greater Than, Less Than, or Is Equal To to define how a business process operates. A business rule can define how values contained in a received XML document should affect the values created in an XML document that is sent, or how those received values should affect what value is written in a database, or other things.
Imagine, for example, a simple vocabulary that defines the term Maximum Allowed Order Quantity, whose value is set to 100, and the term Quantity Requested, whose value is derived from a specified element in received XML documents that correspond to the schema used for placing orders. A business analyst might create a rule stating that if the Quantity Requested in an incoming order is greater than the Maximum Allowed Order Quantity, the order should be rejected, perhaps resulting in an appropriate XML document being sent back to the originator of this order.
To execute a business policy, an orchestration can contain a Call Rules shape that creates an instance of the Business Rule Engine, identifies which policy to execute, and then passes in the information this rule needs, such as a received XML document. The Business Rule Engine can also be invoked programmatically through a .NET-based object model, which allows it to be called from applications that do not use the BizTalk Server 2004 engine. This means that Windows Forms applications, software exposing Web services, and anything else built on the .NET Framework can use the Business Rule Engine whenever it helps to solve the problem at hand.
Both vocabularies and business rules can be much more complicated—and much more powerful—than the simple examples described here. But the core idea of defining a vocabulary and then defining sets of rules that use that vocabulary is the heart of the Business Rule Engine. The goal is to provide a straightforward way for BizTalk Server 2004 users of all kinds to create and work with the rules that define business processes.
Orchestration abstracts the flow of a business process, expressing it graphically rather than in code. Similarly, the Business Rule Engine enables you to express the rules of a business process in a higher-level way. Together, these two technologies provide an effective approach to creating business logic.