Click here to Skip to main content
15,886,776 members
Articles / Programming Languages / C#

Roles, Role-Links and Parties Revisited Using a Simple MailOrder Processing System

Rate me:
Please Sign up or sign in to vote.
4.00/5 (2 votes)
6 Dec 2011CPOL3 min read 26.7K   308   2   2
A simple mail order company case solved using Roles and Parties

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).

MailOrderCompanyCase.PNG

Conditions

The zip codes covered by the various shippers keep changing due to various conditions.

Problem to be Solved!

  1. Design a system where the Zipcode assigned to shippers can be easily changed without storing the specific shippers information.
  2. Adding a new shipper can be done easily.
  3. 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.

Role.PNG

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.

RoleLinks.PNG

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.

PartiesAndBP.PNG

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.

BindPartyToRole.PNG

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.

RoleLinkOrchestration.PNG
C#
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.

InputFile.PNG

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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect AT&T Wi-Fi Services
United States United States
Naveen has done his Masters (M.S.) in Computer science, has started his career programming the mainframes and now has more than a decade of programming, development and design experience. Naveen has a sharp eye and keen observation skills. Naveen has worked for several companies and strived hard to build large scale business applications and bringing better solutions to the table.
Quite recently Naveen has built a fairly complex integration platform for a large bank. His hobbies include training, mentoring and research. Naveen spends his free time visiting National Parks nationwide.

Naveen has developed the BizTalk Control Center (BCC)
http://biztalkcontrolcenter.codeplex.com

Comments and Discussions

 
QuestionNeed more info -- Pin
Shrilata Ellaboina5-Jun-15 1:24
Shrilata Ellaboina5-Jun-15 1:24 
GeneralNeed some source for learind biztalk Pin
kollipara.raki29-Aug-13 4:28
kollipara.raki29-Aug-13 4:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.