For those of you who would like to know what role links are and how you can use them in everyday life, I have a very simple customer request, and an even simpler prototype to demonstrate how to implement role links.
My situation is that I process EDI (HIPAA) files, and there is a standard map that translates the file to a flat file structure. However, the output needs to go into a client specific folder for the existing process to start.
Looking at the source of all truth and knowledge here:
A role is a collection of port types that either uses a service or implements a service. A role defines how parties interact with orchestrations. For example, an orchestration might use the role of Shipper. The Shipper has one or two parties associated with it. When the orchestration decides which shipping company to use to ship an item, it compares the prices of the parties in the Shipper role.
With my limited knowledge of Role Links, I thought that this might be a way to have one orchestration tied to an variable list of send ports. I figured that if I was a Shipper, I want to decide which shipping company (in my case two different folders) and then send it off to them.
- Receive a file
- Interrogate the contents of the file for who the sender is
- Set the Role Link
- Send it out with some type of indicator so I know which sender it was
Pretty easy I thought, and actually implementing it was not too hard.
- I created an empty BizTalk project
- I constructed a sample file and since I am lazy, I made Data a distinguished field.
- I then created an orchestration that had a Port Type defined from the schema I just created.
- I then created a Recieve Port using the FilePortType.
- I then created a new Role Link Type and named it SendingRoleLinkType
- When you expand the new link type, and right click on Role_1, it asks you to Add Port Type
- So of course I do, and I choose the existing port type, in the Port Type Wizard
- I also rename the Role_1 to Sender
- I then created a role named Destination
- I am using an existing Role Link Type already defined
- It is the Consumer role.
- I created two parties and for the HIPAA accelerator, the format is EDI:\\ISASenderID:Qualifier:GSSenderID
- These parties are defined as Party1 (EDI:\\123456789:ZZ:123456789) and Party2 (EDI:\\987654321:ZZ:9876543521) CORRECTION: the parties should have been defined as EDI://123456789:ZZ:123456789 and EDI://987654321:ZZ:9876543521 for them to be correct
- I then created an expression after my receive shape to assign the role link, and here is the code:
Notice that in the argument 1 of Party, is the Value defined in the Party Definition, and obscurely, the OrganizationName (EDI) is the value it is looking up against. I am pulling the partner information (FileMsg.Data) out of the file (which we will see later).
- I then created a send shape and connected it to the Destination Port Link
- I deployed the project and bound the input to a default xml pipeline
- Now the part that exposes the power of Role Links I created a send port for trading partner 1 called, oddly enough, Party 1 Destination and set the path to E:\Role Link\Party1\%SourceFileName%.%MessageID%.xml, I did the same for trading partner 2, called Party 2 Destination and set the path to E:\Role Link\Party2\%SourceFileName%.%MessageID%.xml
- In the Party definition I clicked on the send port and chose the correct send port:
- Now we need to ‘bind’ the sending to the correct variable port, how you do that is if you expand the Roles, you will see the Sender Role
- Right click this and Enlist the Party, Enlist Party1 Then you come up with a Elist Party Properties dialog where you choose which of the ports defined in step 18 to use:
- After that is completed, you can enlist the orchestration and start throwing files, oh, here is a sample input to show you the data it was pulling:
Things to take away from this little tutorial:
Role Links allow you to create a lookup feature within an Orchestration to determine where to send the data, and still have all of the information available to be modified through the administration console.
The example here is for one business process, in my immediate need, for eligibility files, but later we are going to need to have a