BizTalk Server - Rules Engine

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server > August 2004 > Rules Engine





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Rules Engine
Brent

2004-08-09, 5:50 pm

Hi,

I have a simple BizTalk Rules Engine Policy that checks for a
condition in a message, and if the contition exists, it calls a .net
class to add a field from the current message into an ArrayList(). If
I hardcode the parameter to the method as a string, all works fine.
As soon as a change the rule to pull out a field from the message and
pass that into the .net class method, I blow up in the rules engine.
I'm unable to get breakpoints to fire in BTSNTSvc.exe in the
non-working case, however they do fire in the case where I hardcode
strings. Any ideas?

Thanks,
Brent.

Microsoft.RuleEngine.PolicyExecutionException: An exception occurred
inside the rule engine instance executing policy "KeywordMining". --->
Microsoft.RuleEngine. RuleEngineRuntimeMemberInvocationFailure
Exception:
An exception occurred when invoking class member
KeywordUtils.KeywordList.AddKeyword in assembly KeywordUtils,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=e01bf397f73ec37b.
---> System.ArgumentException: Object type cannot be converted to
target type.


at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters,
CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean
verifyAccess)


at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters,
CultureInfo culture, Boolean verifyAccess)


at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters,
CultureInfo culture)


at System.Reflection.MethodBase.Invoke(Object obj, Object[]
parameters)


at Microsoft.RuleEngine.Rete.ClassMemberMethod.Invoke(Object
classObject, Object[] parameters)


--- End of inner exception stack trace ---


at Microsoft.RuleEngine.Rete.Rete.ProcessException(Exception ex)


at Microsoft.RuleEngine.Rete.Rete.ExecuteInternal(Object facts,
Object data)


at Microsoft.RuleEngine.Rete.Rete.ProcessingLoop(Operation
operation, Object facts, Object data, EngineState nextState)


at Microsoft.RuleEngine.Rete.Rete.Execute(Object facts)


at Microsoft.RuleEngine.RuleEngine.Execute(Object facts)


at Microsoft.RuleEngine.Policy.ExecuteInternal(Object facts)


--- End of inner exception stack trace ---


at Microsoft.RuleEngine.Policy.ExecuteInternal(Object facts)


at Microsoft.RuleEngine.Policy.Execute(Object facts)


at Microsoft.RuleEngine.Policy.Execute(Object[] facts)


at RE.KeywordMinor.segment3(StopConditions stopOn)


at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s,
StopConditions stopCond, Exception& exp)

Microsoft.RuleEngine.PolicyExecutionException

Scoped@

KeywordMinor.??__scope0

KeywordMinor.Transaction_2

KeywordMinor.KeywordMinor

AdTarget.AdTarget

00000000-0000-0000-0000-000000000000





Microsoft.RuleEngine.PolicyExecutionException: An exception occurred
inside the rule engine instance executing policy "KeywordMining". --->
Microsoft.RuleEngine. RuleEngineRuntimeMemberInvocationFailure
Exception:
An exception occurred when invoking class member
KeywordUtils.KeywordList.AddKeyword in assembly KeywordUtils,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=e01bf397f73ec37b.
---> System.ArgumentException: Object type cannot be converted to
target type.


at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters,
CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean
verifyAccess)


at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters,
CultureInfo culture, Boolean verifyAccess)


at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters,
CultureInfo culture)


at System.Reflection.MethodBase.Invoke(Object obj, Object[]
parameters)


at Microsoft.RuleEngine.Rete.ClassMemberMethod.Invoke(Object
classObject, Object[] parameters)


--- End of inner exception stack trace ---


at Microsoft.RuleEngine.Rete.Rete.ProcessException(Exception ex)


at Microsoft.RuleEngine.Rete.Rete.ExecuteInternal(Object facts,
Object data)


at Microsoft.RuleEngine.Rete.Rete.ProcessingLoop(Operation
operation, Object facts, Object data, EngineState nextState)


at Microsoft.RuleEngine.Rete.Rete.Execute(Object facts)


at Microsoft.RuleEngine.RuleEngine.Execute(Object facts)


at Microsoft.RuleEngine.Policy.ExecuteInternal(Object facts)


--- End of inner exception stack trace ---


at Microsoft.RuleEngine.Policy.ExecuteInternal(Object facts)


at Microsoft.RuleEngine.Policy.Execute(Object facts)


at Microsoft.RuleEngine.Policy.Execute(Object[] facts)


at RE.KeywordMinor.segment3(StopConditions stopOn)


at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s,
StopConditions stopCond, Exception& exp)

Microsoft.RuleEngine.PolicyExecutionException
Alvaro Miranda [MSFT]

2004-08-09, 5:50 pm

Based on the exception it seems the parameter passed is not a string. what
is the type of the field from the message?

--------------------[vbcol=seagreen]
19:11:45 GMT)[vbcol=seagreen]
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onlin
e.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!postnews2.google.com!no
t-for-mail[vbcol=seagreen]

This posting is provided "AS IS" with no warranties, and confers no rights.

EBusiness Server Team

Matt Milner

2004-08-10, 5:52 pm

I'd guess that the parameter type you want is a TypedXmlDocument instead of
a string. This type is defined in the business rule assembly.

If you want to test this out, set the parameter type to be "Object" and then
put a breakpoint on the first line. You should be able to test in the
debugger and see what type the incoming object is.

Matt


"Alvaro Miranda [MSFT]" <alvarom@online.microsoft.com> wrote in message
news:BlFn6qlfEHA.1600@cpmsftngxa06.phx.gbl...
> Based on the exception it seems the parameter passed is not a string. what
> is the type of the field from the message?
>
> --------------------
> 19:11:45 GMT)
>

cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onlin
>

e.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!postnews2.google.com!no
> t-for-mail
>
> This posting is provided "AS IS" with no warranties, and confers no

rights.
>
> EBusiness Server Team
>



Brent

2004-08-10, 5:52 pm

Hi,

I tried making the parameter type on my C# assembly an object, but I
still get the error and the breakpoints don't fire. I do hit the
constructor for the object, I just never get a call to the method, it
seems the Rules Engine takes over and aborts before my method gets
called.

I checked the fact schema type and it is System.String the same as
what my original class expects. In both cases (object or
System.String) I can hardcode the rule to a string constant, and all
works fine.

Any other ideas?

Thanks,
Brent.

"Matt Milner" <matt.milner@m3technologypartners dot com> wrote in message news:<#cUm5LufEHA.3292@TK2MSFTNGP10.phx.gbl>...[vbcol=seagreen]
> I'd guess that the parameter type you want is a TypedXmlDocument instead of
> a string. This type is defined in the business rule assembly.
>
> If you want to test this out, set the parameter type to be "Object" and then
> put a breakpoint on the first line. You should be able to test in the
> debugger and see what type the incoming object is.
>
> Matt
>
>
> "Alvaro Miranda [MSFT]" <alvarom@online.microsoft.com> wrote in message
> news:BlFn6qlfEHA.1600@cpmsftngxa06.phx.gbl...
Alvaro Miranda [MSFT]

2004-08-12, 2:46 am

Can you send the rule definition (and some sample message) and the method
definition?

--------------------[vbcol=seagreen]
<BlFn6qlfEHA.1600@cpmsftngxa06.phx.gbl>
<#cUm5LufEHA.3292@TK2MSFTNGP10.phx.gbl>[vbcol=seagreen]
21:11:01 GMT)[vbcol=seagreen]
cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.s
ul.t-online.de!t-online.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!p
ostnews2.google.com!not-for-mail[vbcol=seagreen]
news:<#cUm5LufEHA.3292@TK2MSFTNGP10.phx.gbl>...[vbcol=seagreen]
instead of[vbcol=seagreen]
then[vbcol=seagreen]
what[vbcol=seagreen]

This posting is provided "AS IS" with no warranties, and confers no rights.

EBusiness Server Team

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com