Passing a message to BRE using call rules shape in biztalk

Business Rule Engine is a powerful tool in BizTalk stack for creating, testing, publishing, and deploying rule sets for our Business process. I am going to demonstrate how to call a policy from an Orchestration using call rules shape using message as the parameter.

Scenario : Suppose we receive a Customer details message which also contains the CustID. We'll check the CustID and see if the Customer is new or already a member. If the customer is new we'll set the IsNew field to YES.


First of all we'll start with creating FACTS in BizTalk Rule composer.
Open BizTalk Rule composer and go to Vocabularies and create a new Vocabulary and then create a new definition for XMLSchema and select the schema created in the project. For CustID a get operation is created as follows :

For IsNew a set operation is performed as follows :

After creating the vocabularies publish the vocabularies so that it can be
used to create a Policy.

Next step is to create a Policy and a rule in BRE. It goes like this :

This Policy is created such that any CustID greater than 21 would set the
IsNew field to YES. This Policy will be called from the Orchestration using call
rule shape.


Input Schema :

The input schema contains Customer details which contains fields CustID and IsNew.


Orchestration view :
The Orchestration contains a receive shape, send shape, logical receive port and send port. A message is created using InputSchema as message type.


Call rules shape :
In call rules shape the policy that we have created is selected and parameters will automatically be populated. In this case Message_2 is shown. This whole message is passed to BRE and in return modified message is received.

Input Message :

<ns0:Root xmlns:ns0="http://BRE_Samples.InputCustomer">
  <Customer>
    <FirstName>RAhul</FirstName>
    <LastName>Madaan</LastName>
    <CustID>23</CustID>
    <IsNew>IsNew_0</IsNew>
  </Customer>
</ns0:Root>

Output message :

<?xml version="1.0" encoding="utf-8"?><ns0:Root xmlns:ns0="http://BRE_Samples.InputCustomer">
  <Customer>
    <FirstName>RAhul</FirstName>
    <LastName>Madaan</LastName>
    <CustID>23</CustID>
    <IsNew>YES</IsNew>
  </Customer>
</ns0:Root>

Call rule shape not any showing parameters ?? 
This problem is related to BRE facts that we had created. When developing facts we have to specify the DocumentType property of the fact. This property should be same as the fully qualified name of the schema otherwise the call rule shape will not show the any parameters. This issue is of call rule shape not finding the matching message to the schema which is deployed with the rule.

Note: Original post by Rahul Madaan from biztalkvillage

Popular posts from this blog

DTS package BAM_DM_ResendJournalActivity already exists on server

The BAM Portal website Default Web Site is not valid

BizTalk Server Service Pack and cumulative update list