A value is not updated in a database when an orchestration calls a Call Rules shape in BizTalk Server 2006 or in BizTalk Server 2004 (897292)
The information in this article applies to:
- Microsoft BizTalk Server 2004 Enterprise Edition
- Microsoft BizTalk Server 2004 Standard Edition
- Microsoft BizTalk Server 2004 Partner Edition
- Microsoft BizTalk Server 2004 Developer Edition
- Microsoft BizTalk Server 2006 Enterprise Edition
- Microsoft BizTalk Server 2006 Standard Edition
- Microsoft BizTalk Server 2006 Developer Edition
SYMPTOMSConsider the following scenario. In Microsoft BizTalk Server 2004 and in Microsoft BizTalk Server 2006, you have an orchestration that calls a Call Rules shape. The Call Rules shape uses a business policy that evaluates a condition or fires an action that makes a connection to the database. When this orchestration runs, you find that the condition is not evaluated or the action of the rule is not fired.
Note When you click Test Policy in the Business Rules Composer to test the policy, the condition is evaluated or the action is fired successfully.CAUSEWhen you click Test Policy in the Business Rules Composer, a DataConnection object is automatically built for you. Additionally, the database is updated after execution finishes. However, when you call the same policy from an orchestration by using the Call Rules shape, no DataConnection object is passed to the policy.
Note If you build the rules by using database objects where "database binding type"= "Data table/data row", the composer executes a SELECT * FROM TABLE command and asserts the resulting rows as a TypedDataTable class when the policy is tested. In the following instructions, you must create a TypedDataTable in the same way and use it instead of a DataConnection object, instead of creating a DataConnection object. For more information, see the BizTalk Business Rules documentation.RESOLUTIONTo resolve this problem, use one of the following methods:Create a DataConnection object
Create a DataConnection object in the orchestration, and pass the DataConnection object into the Call Rules shape with the document and any other objects that you pass in. If the policy changes the database data, you must commit the transaction after the policy executes. For an example of how to do this, see the sample code in the "More Information" section.
Add a FactRetriever object
Add a FactRetriever object to the policy. This object is called when a policy is fetched and can be used to create and to assert the DataConnection object. In BizTalk Server 2006, a second interface called IFactRemover can be defined on the same object and is called when the policy is disposed. Therefore, you can commit the database changes when the policy has finished executing. The advantage of using the second resolution is that the FactRetriever object is set up when the policy is created. Orchestrations that use the policy do not have to be aware that a database is used. The drawback is that the database must be known when the policy is created, and you cannot use a different database at execution time.
Modification Type: | Major | Last Reviewed: | 8/14/2006 |
---|
Keywords: | kbBTSRules kbBTSOrchestration kbinfo kbtshoot kbprb KB897292 kbAudDeveloper kbAudITPRO |
---|
|