You are on page 1of 35

BizTalk Server

Introduction To BizTalk Server 2006

© Copyright 2007 Sapient Corporation 1


AGENDA

What is BizTalk
Xml Schemas
BizTalk Components
Architecture Overview
Adapters
Ports
Receive Ports
Send Ports
PipeLines
ReceviePipeLine
SendPipeLine
Stages
Messages
Messages Delivery Patterns
Subscriptions
Message Box
Demo
Mappings
Functoids
How to use Functoids
Business Process
Orchestration
Shapes / Activity
A Simple Orchestration.

© Copyright 2007 Sapient Corporation 2


What is a BizTalk Server

"It's a messaging system for enterprise architecture." ·


"BizTalk allows you to connect different entities to one central location."
It allows you to Integrate Various Applications Through Adapters.
"It gives you a method of processing live messages.“

© Copyright 2007 Sapient Corporation 3


Xml Schema
XML Schema is a World Wide Web Consortium (W3C) standard for defining the
structure and content of XML documents. In short, this means that you can define how
an XML document should look and what types it should conform to; it is a form of data
contract.
BizTalk is driven by messages, which, in most cases, are based on an XML schema that
must be deployed to BizTalk.

<xs:schema xmlns:xs=”http://www.w3.org/2001/XMLSchema”>
<xs:element name=”Person”>
<xs:complexType>
<xs:sequence>
<xs:element name=”Name” type=”xs:string”/>
<xs:element name=”Age” type=”xs:int”/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

This schema defines an element called Person that contains a complex type, which, in
its simplest form, is a collection of subelements (like a class in object-oriented
rogramming). Two further elements with differing data types have been defined within
this complex type.

© Copyright 2007 Sapient Corporation 4


Xml Schema Continued…

The following is the XML document that conforms to this schema:


<Person>
<Name>Lucy</Name>
<Age>5</Age>
</Person>
Defining the schema in this way enables you to enforce how you expect
data to be encoded or represented. This schema can be given to any
consumers of your application to ensure that they respect this contract and
it enables them to communicate with you easily.

Creating BizTalk Schemas

© Copyright 2007 Sapient Corporation 5


BizTalk Key Components

© Copyright 2007 Sapient Corporation 6


Architecture Overview

© Copyright 2007 Sapient Corporation 7


Messages

Messages are the lifeblood of every BizTalk solution.


If you can save it, send it, or serialize it, then it can be a message that is
usable to the BizTalk system.

© Copyright 2007 Sapient Corporation 8


Message Delivery Patterns

Scatter-gather
Price Bidding Example.
Request-reply
HL7 Messaging Example.
Publish-subscribe

© Copyright 2007 Sapient Corporation 9


Adapters

Adapters provide connectivity for BizTalk to and from the outside world.
Adapters work with a transport and have no underlying knowledge of the data that will be sent or
received. They receive a byte stream from the wire and feed the BizTalk engine.

In the receive case, the adapter is responsible for listening or polling for data and wrapping that
data in a BizTalk message.

In the case of listening, it may listen on a endpoint (or URL) for incoming data and will
communicate with the remote system.

In the polling scenario, the behavior will typically involve periodically checking an endpoint for
new data that needs to be received into BizTalk.

In the send case, the adapter is responsible for receiving messages from the BizTalk
MessageBox and transmitting them to the remote system, using their associated transport or
protocol.

Once an adapter has received the message, it’s then responsible for passing that message to
the BizTalk Messaging Engine for processing. The Messaging Engine will process the message
in a pipeline after receiving a message and before sending a message.

© Copyright 2007 Sapient Corporation 10


Xml Schema Continued…

Context Properties
Context properties are used extensively by BizTalk adapters.
An example of a context property is the filename of a file that BizTalk has
retrieved from a filesystem using the File adapter. The File adapter writes the
filename into the context during processing; this can then be accessed via
pipeline components and BizTalk orchestrations.
Batching
Batching is an optimization within the engine, enabling a receive location to
process multiple units of work as part of the same batch, thereby reducing the
number of BizTalk MessageBox roundtrips required and enabling asynchronous
processing for messages
In-Box Adapters
JD Edwards EnterpriseOne
JD Edwards OneWorld XE
ODBC Adapter for Oracle Database
PeopleSoft
SAP

© Copyright 2007 Sapient Corporation 11


Xml Schema Continued…

Subscriptions
Once a message has been processed by the adapter and associated pipeline, it
needs to be routed to an interested party. A BizTalk orchestration or send port
can register its interest in a specific message via subscriptions.
MessageBox
Once the message has passed from the adapter and through the pipeline, the
BizTalk Message Agent,which runs as part of a BizTalk host instance, is
responsible for evaluating who has subscribed to this message and committing it
into the BizTalk MessageBox.
The MessageBox is the heart of any BizTalk solution in that without it nothing
would work. All inbound and outbound messages, along with orchestration
execution, dehydration, rehydration, and message tracking, rely on the BizTalk
MessageBox.
Hosts
A BizTalk host is a logical representation of a runtime process. Each host may
contain a combination of Receive or Send adapters (and their associated receive
and send ports) or orchestrations.

© Copyright 2007 Sapient Corporation 12


Orchestration…

Orchestration
The most basic definition of a BizTalk orchestration is that it is a collection of code
that can be used to process data.
BizTalk orchestrations enable you to implement a business process using a visual design
tool called the Orchestration Designer.
The orchestration is compiled into .NET code and, ultimately, into a .NET
assembly;
leverages the .NET side-by-side (SxS) functionality, which allows multiple
versions of an orchestration to be deployed at any time.
An orchestration can be created either by a message that it subscribes to or by
being invoked by another orchestration.
In the case of an orchestration subscribing to a message, the orchestration must
have a Receive shape at the top.

© Copyright 2007 Sapient Corporation 13


BizTalk PipeLines

Pipelines
Pipelines provide the ability to perform data processing and validation operations on
incoming and outgoing messages.
Incoming messages use receive pipelines, and outgoing messages use send pipelines.

BizTalk provides four pipelines in-box


The following pipelines are available on the receive side:
XmlReceive — The XmlReceive pipeline contains the XML Disassembler pipeline
component.
PassThruReceive — The PassThruReceive pipeline contains no pipeline
components.
And the following pipelines are available on the send side:
XmlTransmit — The XmlTransmit pipeline contains the XML Assembler
component.
PassThruTransmit — The PassThruTransmit pipeline contains no pipeline
components.

© Copyright 2007 Sapient Corporation 14


BizTalk PipeLines

Receive Pipeline stages


Decode:- In the Decode stage any processing required to enable the
message to be processed by subsequent stages is performed. Common
examples are decryption or decompression, which must be performed
before, say, disassembly or validation.

Disassemble:- Depending on the component, the Disassemble stage will be


responsible for identifying the type of message, conversion to XML, as
required, or splitting up a message into separate, discrete messages.

Validate:- The Validate stage is responsible for performing message


validation. This is typically used to validate an XML message against an
XML schema.

Resolve Party:- The Resolve Party stage is used to identify the sender of
the message, typically using an X509 Certificate or the Windows user, which
is supplied by the adapter.

© Copyright 2007 Sapient Corporation 15


BizTalk PipeLines

Send Pipeline stages


Pre-Assemble:- In the Pre-Assemble stage any processing required to enable
the message to be processed by subsequent stages is performed. This stage is
often used to make any last-minute changes to an XML, message before it’s
converted to a flat file by the Assemble stage.

Assemble:- The Assemble stage is the opposite of the Disassemble stage in that
it is responsible for converting the message from XML, typically to a different
format such as a flat file. It’s also possible to assemble multiple messages into
one output message.

Encode:- The Encode stage is used to perform any final changes to a message.
Typically, these include encoding, encryption, or compression.

© Copyright 2007 Sapient Corporation 16


Xml Schema Continued…

Ports
A port is essentially a container of locations where you can obtain data.
A port is a “logical” container for the “physical” receive location.
Receive Port Structure

 Send Port Structure

© Copyright 2007 Sapient Corporation 17


Xml Schema Continued…

Groups allow you to take a single, outbound message and send it to


multiple ports. One port may be a file drop, another a SQL database
update, and a third may be a call to a web service.

© Copyright 2007 Sapient Corporation 18


File Adapter

The File adapter is arguably one of the most frequently used adapters that BizTalk provides. As the name
implies, it can monitor a filesystem directory for files matching a configured extension to arrive.
The File adapter works in two modes. After detecting a new file, the File adapter places a lock on it to
ensure that another thread or machine doesn’t try to process the file at the same time. It maintains the
lock until the file has passed through the pipeline and has been successfully written to the MessageBox.
Alternatively, it can be configured to rename the file to prevent another process from picking up the file
while it is being processed.
If the MessageBox persistence of the message is successful, the file is deleted from the filesystem.
Conversely, if an error occurs during adapter or pipeline processing, the file is returned to the filesystem
and will be processed again. In the case where it was renamed, it will be renamed to its original name.

© Copyright 2007 Sapient Corporation 19


Xml Schemas Demo

© Copyright 2007 Sapient Corporation 20


Continued…

BizTalk Server - PART II

© Copyright 2007 Sapient Corporation 21


Orchestration.

Orchestration
The most basic definition of a BizTalk orchestration is that it is a collection of code
that can be used to process data.
BizTalk orchestrations enable you to implement a business process using a visual design
tool called the Orchestration Designer.
The orchestration is compiled into .NET code and, ultimately, into a .NET
assembly;
leverages the .NET side-by-side (SxS) functionality, which allows multiple
versions of an orchestration to be deployed at any time.
An orchestration can be created either by a message that it subscribes to or by
being invoked by another orchestration.
In the case of an orchestration subscribing to a message, the orchestration must
have a Receive shape at the top.

© Copyright 2007 Sapient Corporation 22


Orchestration

Activation
By a message arriving in the MessageBox to which an orchestration has
subscribed. This is called an activating receive.

Following an invocation from another orchestration.

© Copyright 2007 Sapient Corporation 23


Orchestration.

Activating Receive

The first scenario, when an orchestration is created following a message’s arrival,


is the most common method and is called an activating receive because a
message’s arrival activates a new instance of an orchestration.

An activating receive is created by dragging a Receive shape onto an


orchestration as the first shape. You cannot have an activating receive in any
other position within an orchestration, because that cannot be used to activate the
orchestration. You would be trying to start the orchestration when it had already
been started.

© Copyright 2007 Sapient Corporation 24


Orchestration

Invoked
The second scenario is when an orchestration is created from another
orchestration. This is configured by dragging a Call Orchestration or Start
Orchestration shape onto the orchestration design surface.

Invoking orchestrations in this way is typically used when refactoring


orchestrations; if you have the same core business process logic duplicated in
multiple places, it’s easier to place it in one shared orchestration.

Ex: Auditing Mechanism, Payment Processing.

Persistence Points
BizTalk itself has been designed to be entirely stateless at the BizTalk Server
layer.This stateless model is achieved by persisting the in-memory representation
of an orchestration and any associated messages in SQL Server, which acts as a
durable store. The engine does this in an intelligent manner rather than persisting
the entire orchestration each time. It will persist only the parts that it needs to.

© Copyright 2007 Sapient Corporation 25


Orchestration.

Persistence Points Continued…


Messages and orchestrations are always processed within the scope of a SQL
transaction. So if a BizTalk Server were to suffer a power outage, for example, a
message being consumed by an orchestration while in memory would not be lost.
Instead, the transaction (and hence any orchestration state or messages) would
be rolled back to its last good state that was persisted in the BizTalk
MessageBox.
Orchestrations also persist their state at various points during execution,
effectively creating a checkpoint. This checkpointing (referred to as persistence
points) is crucial to provide resilience against failure.
Give a scenario
Uses .Net Serialization Concepts
Following things incur a persistence point during orchestration execution:
Send shape
Start Orchestration shape
End of a long-running scope
Receive, Delay, and Suspend shapes
End of Orchestration

© Copyright 2007 Sapient Corporation 26


Orchestration.

Dehydration
Explain with Scenarios.

© Copyright 2007 Sapient Corporation 27


Orchestration.

Versioning
BizTalk leverages the .NET side-by-side capability by utilizing the Global
Assembly Cache (GAC).
The GAC enables multiple versions of .NET assemblies to be deployed side by
side. Because an orchestrations is compiled into a .NET assembly, it can
leverage this feature. So, if you have an orchestration already deployed and have
instances of this orchestration dehydrated, you can modify the orchestration,
update the version number, and deploy to your BizTalk servers.
After this new version has been deployed, you will see both versions in the GAC.
When one of the dehydrated orchestrations wakes up, it will continue to use the
original .NET assembly version, not the new version. Any new activations of this
orchestration (i.e., not orchestrations rehydrating) will use the new orchestration
version deployed as part of the new assembly.

© Copyright 2007 Sapient Corporation 28


Orchestration.

Port Binding
Specify Later, which enables you to bind your logical ports to physical receive or
send ports at deployment time, which is advisable in almost all cases
Specify Now, which enables you to configure the physical port at development
time, which is effectively hard-coding your configuration. This is not advisable,
because any configuration changes will require the orchestration to be recompiled
and deployed.
Direct port binding enables you to loosely couple orchestrations together or loosely
couple orchestrations from the message source. This approach is particularly useful
when you want to implement a publish-and-subscribe messaging architecture
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
Orchestrations with direct bound ports are not bound to physical ports at deployment time but
instead rely on messages arriving from other receive ports or being created from other
orchestrations at runtime.

© Copyright 2007 Sapient Corporation 29


Orchestration.

Distinguished Field and Promoted

© Copyright 2007 Sapient Corporation 30


Orchestration.

Correlation

© Copyright 2007 Sapient Corporation 31


Orchestration.

Correlation Set
you’ve been asked to construct a routing application that will facilitate an external
authorization process for purchases over $1,000. You’ll have an inbound
message that you accept on an input port. Based on the dollar value of the price
element, you’ll either send the message straight to a final send port or you’ll direct
it to an external authorization process. If the message is sent for approval, you
want the orchestration to “pause” and wait for the same message to return before
it continues processing,To accomplish that, you’ll need to create what is known
as a correlation set.
a correlation set allows you to declare that a promoted property will be used for
identification on any related messages that leave and return to the orchestration.
Portions of the orchestration must subscribe to this correlation set so that the
BizTalk engine is able to differentiate between an original message and one that
is a continuation of work previously done.

© Copyright 2007 Sapient Corporation 32


Orchestration.

Consuming a WebService

The BizTalk orchestration retrieves the XML purchase order (PO) message file
from the receive location In folder.
The orchestration passes the XML PO message as a string to the Web service.
The Web service receives the XML PO message string, converts it to a
corresponding XML invoice message string, and returns it as a string to the
calling orchestration.
The orchestration writes the invoice message to an .xml file in the Out folder.
In the middle of the orchestration, a Send shape and a Receive shape are
connected to a port named POWebServicePort. This is where the orchestration
makes a synchronous Web method call to the external Web service through a
request-response port, specifying to send the message first.
The logical request-response port is bound with a physical Solicit-Response send
port. When calling the external Web service, you must make sure that the Web
method name you are calling matches the Operation name on
the port, or you will receive a SOAP exception.

© Copyright 2007 Sapient Corporation 33


Orchestration.

Correlation Set
you’ve been asked to construct a routing application that will facilitate an external
authorization process for purchases over $1,000. You’ll have an inbound
message that you accept on an input port. Based on the dollar value of the price
element, you’ll either send the message straight to a final send port or you’ll direct
it to an external authorization process. If the message is sent for approval, you
want the orchestration to “pause” and wait for the same message to return before
it continues processing,To accomplish that, you’ll need to create what is known
as a correlation set.
a correlation set allows you to declare that a promoted property will be used for
identification on any related messages that leave and return to the orchestration.
Portions of the orchestration must subscribe to this correlation set so that the
BizTalk engine is able to differentiate between an original message and one that
is a continuation of work previously done.

© Copyright 2007 Sapient Corporation 34


© Copyright 2007 Sapient Corporation 35

You might also like