A BizTalk solution generally consists of the following:
A Schema – LeaveApp.xsd
A Property Schema (For exposing the schema properties into
an orchestration and ports.)
An Orchestration – RouteLeaveApplications.odx & ProcessLeaveApplications.odx
A Pipeline (optional)
Schema
The Leave Application Schema encapsulates all the relevant
information required for leave processing. Designing a schema is the first
step in any BizTalk project. Refer to the leave application schema in Figure
5. The elements of the schema are self explanatory.
Figure 5
Orchestrations
An Orchestration is essentially a Business Process. In this
example the Orchestration Workflow has been split into two parts. The first
part routes the Leave Application submitted by the employee to the manager. The
second part is responsible for picking up the APPROVED/REJECTED/TIMEDOUT leave
requests and takes appropriate actions.
A message in an Orchestration binds to a schema, in this
case the “LeaveApp” schema shown in the Figure 5. There are two messages in the
orchestration; one is an incoming message and another is the outgoing message.
The “RouteLeaveApplications” Orchestration performs the
following:
The Orchestration picks up the Leave Request message from
the SharePoint folder.
The message is validated against the number of leaves
available from the Employee table. In the case where no leaves are available
an exception is raised by the stored procedure. This exception is caught by
the Orchestration and the message is sent back to the requested employee's
folder. Refer to the Figure 6.
Figure 6
The “ProcessLeaveApplications” Orchestration performs the
following:
The BizTalk engine monitors the manager's folder in SharePoint
then checks to see if the following conditions have occurred and picks up the message.
Leave Application message Status field set to either
“APPROVED” or “REJECTED.”
Leave Application message Status field set to the default
value, “REQUEST,” is unchanged after the elapsed timeout.
The message picked up in the previous step is routed to the
manager’s boss, in this case to Jack for Approval. In case Jack does not
approve it and the elapsed timeout occurs, the message is again picked up and
its status is set to “TIMEDOUT” and routed back to the employee who has raised
this request, in this case it is “JOE.” Refer to Figure 7.
Dynamic Ports
The BizTalk ports, which are used to interact with SharePoint,
are Dynamic ports. BizTalk can determine the destination folder, but only when
it receives the Leave request message and retrieves the manager name of the employee.
Listing 1: TIMEDOUT message processing
LeaveAppOut = LeaveAppIn;
LeaveAppOut(LeaveWorkflowSystem.Status) ="TIMEDOUT";
LeaveAppOut(LeaveWorkflowSystem.Comments) ="Leave request timed out even after escalation.";
destinationFolder =LeaveAppIn(LeaveWorkflowSystem.EmpName);
SendLeaveAppPort(Microsoft.XLANGs.BaseTypes.Address)=
"wss://win2k-2005-pc:80/sites/BizTalkDemos/"+ destinationFolder + "";
NOTE: The last line in the code specifies the destination of
the message by the setting the value in the Dynamic port. Do not worry about
the SharePoint path hard coding, this can be moved into an environment
variable.
Figure 7