[Solved] BRE.EXT Invocation Exception when called through an Itinerary

Mar 22, 2013 at 4:41 PM
Hi all,

I'm trying to use the ESB Toolkit Extensions with ESB Toolkit 2.1. I already changed all needed assemblies, so that the solution would compile, and added the needed bits in the esb.config as follows:

In <resolvers>
<resolver name="BRE.EXT"  type="Microsoft.Practices.ESB.Resolver.Unity.ResolveProvider, Microsoft.Practices.ESB.Resolver.Unity, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" >
        <resolverConfig>
          <add name="unitySectionName" value="esb.resolver" />
          <add name="unityContainerName" value="BRE.EXT" />
        </resolverConfig>
      </resolver>
In <esb.resolver><typeAliases>
<typeAlias alias="BRE_ResolverProvider" type="Tellago.SOA.ESB.Extensions.Resolvers.Bre.BRE_ResolverProvider, Tellago.SOA.ESB.Extensions.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b01aa156b4424a13" />
And in <containers>
<container name="BRE.EXT">
        <types>
          <type type="IResolveProvider" mapTo="BRE_ResolverProvider" />
          <type type="IFactProvider" mapTo="ItineraryFactProvider" name="ItineraryFactProvider">
            <lifetime type="singleton" />
          </type>
          <type type="IRepositoryProvider" mapTo="SqlRepositoryProvider" name="CurrentRepositoryProvider">
            <lifetime type="singleton" />
            <typeConfig extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement,Microsoft.Practices.Unity.Configuration, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
              <constructor>
                <param name="connectionStringName" parameterType="string">
                  <value value="ItineraryDb"/>
                </param>
                <param name="cacheManagerName" parameterType="string">
                  <value value="Itinerary Cache Manager"/>
                </param>
                <param name="cacheTimeout" parameterType="string">
                  <value value="120" />
                </param>
              </constructor>
            </typeConfig>
          </type>
          <type type="IFactTranslator" mapTo="DefaultFactTranslator" name="DefaultFactTranslator">
            <lifetime type="singleton" />
          </type>
          <type type="IFactTranslator" mapTo="ItineraryFactTranslator" name="ItineraryFactTranslator">
            <lifetime type="singleton" />
            <typeConfig extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement,Microsoft.Practices.Unity.Configuration, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
              <constructor>
                <param name="repositoryProvider" parameterType="IRepositoryProvider">
                  <dependency name="CurrentRepositoryProvider"/>
                </param>
              </constructor>
            </typeConfig>
          </type>
        </types>
      </container>
If I configure a receive location with the ItinerarySelectReceiveXml pipeline to call the BRE policy with the BRE.EXT (BRE.EXT:\messageFile=;policy=MyPolicy;recognizeMessageFormat=true;useMsg=true;version=;useMsgCtxt=true;msgCtxtValues=;useRepromotion=true;) directly, then it works as expected.

Unfortunately I need to make this call through an Itinerary, and there it unfortunately doesn't work, giving me the following exception:
The given key was not present in the dictionary. 

Source: Microsoft.Practices.ESB.PipelineComponents.Dispatcher 

Method: Microsoft.BizTalk.Message.Interop.IBaseMessage Execute(Microsoft.BizTalk.Component.Interop.IPipelineContext, Microsoft.BizTalk.Message.Interop.IBaseMessage) 

Error Source: Microsoft.Practices.ESB.Itinerary.Services 

Error TargetSite: Microsoft.BizTalk.Message.Interop.IBaseMessage ExecuteTransform(Microsoft.BizTalk.Component.Interop.IPipelineContext, Microsoft.BizTalk.Message.Interop.IBaseMessage, System.String, Boolean)  

Error StackTrace:    at Microsoft.Practices.ESB.Itinerary.Services.TransformationService.ExecuteTransform(IPipelineContext context, IBaseMessage msg, String mapNameOrResolverString, Boolean validateSource)
   at Microsoft.Practices.ESB.Itinerary.Services.TransformationService.Execute(IPipelineContext context, IBaseMessage msg, String resolverString, IItineraryStep step)
   at Microsoft.Practices.ESB.PipelineComponents.Dispatcher.Execute(IPipelineContext context, IBaseMessage msg)
Does anyone perhaps know what this means, or had this error before and knows how to correct it?

Thank you very much!

Cheers,
Miguel
Coordinator
Mar 22, 2013 at 5:05 PM

Hey Miguel,

The error typically means that the BRE policy ran but it couldn’t find any conditions matching your rules, thus it did not fire any actions and set any entries in the Resolution collection thus your error: given key not found. It wasn’t found because it wasn’t there, nor added by the BRE.EXT policies.

If it works in the Pipeline, but not in your itinerary, check your values of your message, promoted properties, and other facts being used for your conditions in your Rule, using BizTalk’s admin tool. Turn on ESB tracing, and BRE.EXT Debug interceptor. Apparently some values are not quite the same in the pipeline versus the itinerary processing stage. It could be something as simple as a promoted property value is not what you expect it to be.

HTH

From: miguelcarvalho [email removed]
Sent: Friday, March 22, 2013 10:42
To: dngoins@hotmail.com
Subject: BRE.EXT Invocation Exception when called through an Itinerary [esbextlibrary:437665]

From: miguelcarvalho

Hi all,

I'm trying to use the ESB Toolkit Extensions with ESB Toolkit 2.1. I already changed all needed assemblies, so that the solution would compile, and added the needed bits in the esb.config as follows:

In <resolvers>

<resolver name="BRE.EXT"  type="Microsoft.Practices.ESB.Resolver.Unity.ResolveProvider, Microsoft.Practices.ESB.Resolver.Unity, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" >
        <resolverConfig>
          <add name="unitySectionName" value="esb.resolver" />
          <add name="unityContainerName" value="BRE.EXT" />
        </resolverConfig>
      </resolver>

In <esb.resolver><typeAliases>

<typeAlias alias="BRE_ResolverProvider" type="Tellago.SOA.ESB.Extensions.Resolvers.Bre.BRE_ResolverProvider, Tellago.SOA.ESB.Extensions.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b01aa156b4424a13" />

And in <containers>

<container name="BRE.EXT">
        <types>
          <type type="IResolveProvider" mapTo="BRE_ResolverProvider" />
          <type type="IFactProvider" mapTo="ItineraryFactProvider" name="ItineraryFactProvider">
            <lifetime type="singleton" />
          </type>
          <type type="IRepositoryProvider" mapTo="SqlRepositoryProvider" name="CurrentRepositoryProvider">
            <lifetime type="singleton" />
            <typeConfig extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement,Microsoft.Practices.Unity.Configuration, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
              <constructor>
                <param name="connectionStringName" parameterType="string">
                  <value value="ItineraryDb"/>
                </param>
                <param name="cacheManagerName" parameterType="string">
                  <value value="Itinerary Cache Manager"/>
                </param>
                <param name="cacheTimeout" parameterType="string">
                  <value value="120" />
                </param>
              </constructor>
            </typeConfig>
          </type>
          <type type="IFactTranslator" mapTo="DefaultFactTranslator" name="DefaultFactTranslator">
            <lifetime type="singleton" />
          </type>
          <type type="IFactTranslator" mapTo="ItineraryFactTranslator" name="ItineraryFactTranslator">
            <lifetime type="singleton" />
            <typeConfig extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement,Microsoft.Practices.Unity.Configuration, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
              <constructor>
                <param name="repositoryProvider" parameterType="IRepositoryProvider">
                  <dependency name="CurrentRepositoryProvider"/>
                </param>
              </constructor>
            </typeConfig>
          </type>
        </types>
      </container>

If I configure a receive location with the ItinerarySelectReceiveXml pipeline to call the BRE policy with the BRE.EXT (BRE.EXT:\messageFile=;policy=MyPolicy;recognizeMessageFormat=true;useMsg=true;version=;useMsgCtxt=true;msgCtxtValues=;useRepromotion=true;) directly, then it works as expected.

Unfortunately I need to make this call through an Itinerary, and there it unfortunately doesn't work, giving me the following exception:

The given key was not present in the dictionary. 
 
Source: Microsoft.Practices.ESB.PipelineComponents.Dispatcher 
 
Method: Microsoft.BizTalk.Message.Interop.IBaseMessage Execute(Microsoft.BizTalk.Component.Interop.IPipelineContext, Microsoft.BizTalk.Message.Interop.IBaseMessage) 
 
Error Source: Microsoft.Practices.ESB.Itinerary.Services 
 
Error TargetSite: Microsoft.BizTalk.Message.Interop.IBaseMessage ExecuteTransform(Microsoft.BizTalk.Component.Interop.IPipelineContext, Microsoft.BizTalk.Message.Interop.IBaseMessage, System.String, Boolean)  
 
Error StackTrace:    at Microsoft.Practices.ESB.Itinerary.Services.TransformationService.ExecuteTransform(IPipelineContext context, IBaseMessage msg, String mapNameOrResolverString, Boolean validateSource)
   at Microsoft.Practices.ESB.Itinerary.Services.TransformationService.Execute(IPipelineContext context, IBaseMessage msg, String resolverString, IItineraryStep step)
   at Microsoft.Practices.ESB.PipelineComponents.Dispatcher.Execute(IPipelineContext context, IBaseMessage msg)

Does anyone perhaps know what this means, or had this error before and knows how to correct it?

Thank you very much!

Cheers,
Miguel

Mar 26, 2013 at 3:15 PM
Hi there,

First of all thank you very much for the quick reply!

I debugged the component, and it actually gets from BRE what he should. In other words, the policy works. The only thing my policy makes is setting a context property, which I can see in the dictionary after the policy is executed.
So at the end, my dictionary has 3 arrays: 1 with the BRE execution result (success), another with the message, and a 3rd one with all context properties.

Do you perhaps know if something changed between the version 2.0 and 2.1, that causes the ESB routing service to throw this error?

Thanks in advanced.

Cheers,
Miguel
Coordinator
Mar 26, 2013 at 6:34 PM

No I’m afraid not, at least not without looking at all the details.

The main error is because something is not being set In the resolution. Most likely the map name. In your policy add a rule “ 1=1” and set the map name, run the example and verify it works. If it does, then the error (logic or otherwise) resides in the fact that the rule is not finding everything it needs during runtime to set that resolution entry.

If you are debugging it, I’d set a break point on the result call of the BRE.Ext resolution and manually see which Resolution entries are missing.

HTH

From: miguelcarvalho [email removed]
Sent: Tuesday, March 26, 2013 09:15
To: dngoins@hotmail.com
Subject: Re: BRE.EXT Invocation Exception when called through an Itinerary [esbextlibrary:437665]

From: miguelcarvalho

Hi there,

First of all thank you very much for the quick reply!

I debugged the component, and it actually gets from BRE what he should. In other words, the policy works. The only thing my policy makes is setting a context property, which I can see in the dictionary after the policy is executed.
So at the end, my dictionary has 3 arrays: 1 with the BRE execution result (success), another with the message, and a 3rd one with all context properties.

Do you perhaps know if something changed between the version 2.0 and 2.1, that causes the ESB routing service to throw this error?

Thanks in advanced.

Cheers,
Miguel

Mar 27, 2013 at 3:23 PM
Hi There,

Once more, thanks for the very quick answer.
The main error is because something is not being set In the resolution. Most likely the map name. In your policy add a rule “ 1=1” and set the map name, run the example and verify it works. If it does, then the error (logic or otherwise) resides in the fact that the rule is not finding everything it needs during runtime to set that resolution entry.
That is a very good tip, thanks for that. In this case I'm calling the routing service, so my question is: do you know if I need to set some specific property? I would guess that the service needs something that will make it route my message.

I will also try to restructure my itinerary in a way that I can set a mapping in my policy.

Cheers,
Miguel
Coordinator
Mar 27, 2013 at 3:35 PM

Miguel

You say your error occurs in the Routing Service, however the error you posted claims its happening in the transformation service. Can you verify this?

In any case if it happens in the Routing Service, the resolution needs entries for an Adapter Provider to configure the dynamic adapter or an orchestration for routing. If it’s the Transformation service then it needs a fully qualified map name.

hth

Mar 27, 2013 at 3:43 PM
Hi,
You say your error occurs in the Routing Service, however the error you posted claims its happening in the transformation service. Can you verify this?
That is simple to clarify. After I saw some examples I changed the service from transformation to routing, but posted the first error I ever got.

As you said in the fist reply, it had to be something simple, and indeed i forgot about the basics of what one should set when using either the routing or transformation service.
I remade my itinerary as I mentioned in the last answer, and it works now.

Thank you very much for all your support! Thumbs way up :)

Cheers,
Miguel