Retain request message details scenario in BizTalk

I ran couple of time into this requirement from my customers where they need to retain some of the data from the request message and send them along with the response data in response message.

Scenario

You have a BizTalk application where you receive an employee message which has EmployeeID and EmployeeName  details. Now you need to make a call to another system to pull the salary information of the employee. Finally in the response message you need to send the details (EmployeeID and EmployeeName) which were there in the request along with the salary of the employee.

SalarySchemas.png

Solution

RetainOrch.png

For the scenario mentioned above, lets consider its asynchronous call to the Employee Salary System and that is why I have used correlation to get the corresponding salary response for a salary request in orchestration.

I have created the following schemas for the request and response to Employee Salary System.

SalaryInfoSchemas.png

I am creating the SalaryInfoRequest for Employee Salary System in Transform_1

Transform1

Once I receive the salary details from Employee Salary System, I need to merge that response with the request details. This is being done by creating many-to-one mapping in Transform_2.

Transform2.png

 

Testing the Solution

1. Sign the assembly.

2. Build and deploy the solution from Visual Studio.

3. Configure on BizTalk Management console.

  • Create a receive port and corresponding receive location to receive the Salary Request in orchestration.
  • Create a send port to send the request for salary info to Employee Salary System.
  • Create a receive port and corresponding receive location to receive the response from the Employee Salary System.
  • Create a send port to send the final salary response from orchestration.

4. Generate XML instances of salary request schemas, and put in receive location for receiving the salary request.

TestData-SalaryRequest.png

5. Verify the output in file location configured in send port for the salary info request.

Output-SalaryInfoRequest.png

6. Now Generate XML instance of salary info response schema, and put that in the receive location for receiving the response from Employee Salary System.

TestData-SalaryInfoResponse.png

7. Verify the final salary response in file location configured for salary response.

Output-SalaryResponse.png

See Also

BizTalk Server Resources on the TechNet Wiki

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s