BizTalk Enterprise Integration Patterns - Part 1






3.40/5 (6 votes)
This article explains the Content Enricher pattern of Message Oriented Systems for BizTalk Server 2004.
Introduction
This article is the first part of the BizTalk Integration pattern series. This article discusses about a simple message oriented systems pattern known as Content Enricher Pattern.
Content Enricher pattern - Setting the context...
In message oriented systems, when a message is sent from a source to the destination, it is common that the destination system requires some additional information in order to process the message correctly. The message received by the destination would contain certain "keys" or identifiers, which can be used to obtain this additional information.
- The message received by the destination is known as the "Basic Message".
- The processed message is known as the "Enriched Message".
This pattern discusses about getting that additional information and creating the "Enriched Message".
Content Enricher
The Content Enricher uses information inside the incoming message (e.g., key fields) to retrieve data from an external source. After the Content Enricher retrieves the required data from the resource, it appends the data to the message. The original information from the incoming message may be carried over into the resulting message, or may no longer be needed, depending on the specific needs of the receiving application.
Scenario - A Purchase Order request for a Part
Consider a scenario where a Purchase Order request is made for a Part. The Order message would have the fields PartNo
and QuantityRequired
filled up. The Order schema would look like this...
Note: The Order XML incoming message will have only the fields PartNo
and QuantityRequired
filled up.
The Enricher Pattern implemented as an Orchestration
A Purchase Order request message is received by the "Receive Shape". Next, a WebRequest
message is prepared and a request is sent.
The "Enricher" in this case is a "Web Service", which takes in PartNo
and returns all the additional information required by the Orchestration.
Note: The WSPartStore
port is the "Enricher" in our example. This is the external data source which provides additional information about the message.
The Web Service request has only the PartNo
filled up.
The data received from the Web Service would be used to populate the message, thus "Enriching" the message.
Executing the demo
Input file
The input XML file would have only the PartNo
and QuantityRequired
filled up.
Output file
The output file shall have all the fields filled up.
About the downloadable code
- Unzip the Web Service with the folder names into the C:\inetput\wwwroot directory and setup the Web Service.
- Unzip the BizTalk project zip file with the folder names in the C:\ drive.
- The folder KeyAndBindings contains the Bindings.xml file, which can be imported after the solution is built and deployed.
- Place the OrderMessage in the In folder and check the Out folder.
Some takeaways
- Always select the "WebPortType" created when the "Web Reference" is added to the project while creating "Web Ports" in the Orchestration.
- Additional routing logic needs to be written if you would like to send the message to a different port after the
Message
is populated.