Introduction
I have noticed that BizTalk role-links are not used by developers due to the lack of understanding about it. This article attempts to allay the fears of using role-links in BizTalk. Role-links are not BAS and need not use BAS.
Case Study: A Mail-Order Company
Scenario
A mail order company sends several packages to different destinations. The mail order company uses several shippers
for this purpose. For example FEDEX, UPS and USPS. Every shipper covers certain destination Zip
codes due to proximity of the airports or special delivery processes. The Shippers
destination zip code coverages keep changing during different seasons (spring/summer/fall/winter).
Conditions
The zip
codes covered by the various shippers keep changing due to various conditions.
Problem to be Solved!
- Design a system where the Zipcode assigned to
shippers
can be easily changed without storing the specific shippers
information. - Adding a new
shipper
can be done easily. - Adding a new delivery zipcode to an existing
shipper
.
What is a Role?
A Role
in BizTalk parlance comprises of a port-type using which all the messages are sent out from an orchestration. Using one role, several parties can be attached to it. In the case under consideration, we have a Shipper
role and several parties
(FEDEX, UPS and USPS) attached to it.
What is a Role-Link?
A role-link
can be used to abstract a business process from an actual execution/delivery system. For example in the mail order system, the goal is to send a package to a customer, by hiring an intermediary, a shipper. Every shipper requires data to be sent in a certain format.
What is a Party?
A Party
is an entity
or a business
or an enterprise
outside the boundary of BizTalk to which the data is transmitted. One must enlist
a role-link
with a party in order for it to work.
Binding Party to a Role
When several Parties
are bound to a Role
, as in our case, the ZipCode
field is compared in every party and the message is transmitted to the one which matches it.
Understanding the ShipOrders Orchestration
The ShipOrders
orchestration uses a Role-Link
(ZipCodeShipper
) and a Role
(Shipper
) to send the package ZipCode
information to various Parties
attached to its Role.
ZipCodeShipper(Microsoft.XLANGs.BaseTypes.DestinationParty) =
new Microsoft.XLANGs.BaseTypes.Party(MailOrderMsg.Body.ShippingZipCode, "ZipCode");
The party takes two parameters, the first is the name
and the other is the qualifier
. Notice how the destination party is set, by providing the zipcode
value and the qualifier
"ZipCode
".
The Input XML
NOTE that the ShippingZipCode
is the promoted field.
Development Notes
Error: MailOrderProcessing
: Destination party not found while attempting to send message 'MailOrderMsg
' to (94553, ZipCode).
Resolution: This could happen when the shipper role does NOT have this Zipcode
in its delivery list. One of the enlisted parties must have this ZipCode
added, this could fix the issue.
Downloadable Code
The BizTalk Party configuration is left as an exercise to the developer.
References
Role Links Blog References