May 182012
 

So I was assisting Brian last night put the Business Rule Engine in front of the ESB solution, so it could determine which itinerary to run. I had just completed getting a flow through the ESB myself. So, after some correction of spelling mistakes (come on code, don’t be so picky about absolutely needing strings to be match exactly, do what I want, not what I say), we got down to the guts of why things aren’t working.

We implemented the BRE Policy, tested the message: right clicked the policy and chose test: viola, it worked. However, when we ran it through the Itinerary Selector pipeline component we kept getting an error stating that Itinerary_getitinerary required the parameter @name which was not provided.

The issue is that the folks at Microsoft (or subcontractors paid to do the work for them) put the following code in the Business Rule Engine resolver:

Notice that the TypedXMLDocument that will be submitted to the BRE will always be Microsoft.Practices.ESB.ResolveProviderMessage.

private static Dictionary<string, string> ResolveRules(string config, string resolver, XmlDocument message, Resolution resolution, Microsoft.Practices.ESB.Resolver.BRE.BRE bre) { Dictionary<string, string> dictionary3; int majorRevision = 0; int minorRevision = 0; Policy policy = null; Dictionary<string, string> dictionary = null; string[] strArray = null; object[] facts = null; TypedXmlDocument document = null; string documentType = "Microsoft.Practices.ESB.ResolveProviderMessage"; Dictionary<string, string> resolverDictionary = new Dictionary<string, string>(); if (!resolver.Contains(@":\")) { resolver = resolver + @":\"; } try { ... } }

So how do you create your Business Rules so it adheres to this type of TypedXmlDocument?

When you import a schema to create a vocabulary or use directly within a policy, you will need to change the following property:

image

To look like this:

image

Go ahead and use the xml document all you want!