Exploring Message Assignment in BizTalk: A Step-by-Step Guide
Introduction:
Welcome to this blog where we will explore message
assignment shapes and learn how to assign values to different fields in a
message variable.
Step-by-Step Guide:
1. Start by
creating a new BizTalk project and solution named
"POCMessageAssignment."
2. Create a
strong name key file (snk) and name it "POCMessageAssignment.snk."
Refer to this snk file in your project.
3. In the
deployment tab of the project, set the application name as
"POCMessageAssignment" and save the project.
4. Add a new
schema to the project named "SourceA" with the following fields
• IdentificationNumber
(distinguish this field)
• FirstName
• LastName
• IdentificationNumber
5. Add
another schema named "SourceB" with the following fields:
• ID
(distinguish this field)
• FName
• LName
6. Create an
orchestration named "Process."
7. Create a logical
receive port with a configuration of “Specify Later”. Name it
"POCMessageAssignmentReceiveSourceAPort_1" and set the port type name
as "POCMessageAssignmentReceiveSourceAPortType_1."
8. Define
the following message variables:
• msgSourceA:
Type = SourceA schema
• msgSourceB:
Type = SourceB schema
9. Create a
string variable named "strIdentificationNumber" with the type
"System.String."
10. Connect the
receive shape to the message variable "msgSourceA." Set Activate =
true. Hook up the receive port and receive shape.
11. Below the
receive shape, add a construct shape. Inside it, place a transform shape to
convert from SourceA to SourceB. Use the fully qualified name
"POCMessageAssignment.SourceA_TO_SourceB" for the map. Set the source
as msgSourceA and the destination as msgSourceB. Hard code the ID field as
"Tempvalue." Note that we have assigned a temporary value in the map and we will assign a proper value using the message assignment shape. Map FirstName to FName and LastName to LName. Build the
map.
12. Add a
message assignment shape below the map shape.
13. Write the
following expressions in the message assignment shape:
strIdentificationNumber = msgSourceA.IdentificationNumber;
msgSourceB.ID = strIdentificationNumber;
14. Drag a send
shape below the message construct shape and bind msgSourceB to the send shape.
15. Create a
logical send port with a configuration of "Specify Later" and connect
it to the send shape.
• Name:
POCMessageAssignmentSendSourceBPort_1
• Port Type
Name: POCMessageAssignmentSendSourceBPortType_1
16. Build the
solution and deploy it.
17. Create a
one-way receive port and a receive location with the following names and
configurations:
• Receive Port
Name: POCMessageAssignment.RP
• Receive
Location Name: POCMessageAssignment.RL
• URL:
D:\Developer\Vipin\POCMessageAssignment\IN
18. Create a
one-way send port with the following name and configuration:
• Send Port
Name: POCMessageAssignment.SP
• URL:
D:\Developer\Vipin\POCMessageAssignment\OUT
19. Bind the
receive port, host instance, and send port to the orchestration.
20. Restart the
host instances and start the application.
21. Create a
folder at the following location to store sample files:
• D:\Developer\Vipin\POCMessageAssignment\SampleFiles
22. Generate an
instance of SourceA and save it in the above location.
23. Drop the
SourceA instance in the receive location, and you will find the output file at
the send port location. You can see that the ID field has been assigned a value
from the IdentificationNumber field from SourceA schema
Comments
Post a Comment