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.
Solution
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.
I am creating the SalaryInfoRequest for Employee Salary System in Transform_1
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.
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.
5. Verify the output in file location configured in send port for the salary info request.
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.
7. Verify the final salary response in file location configured for salary response.