BizTalk 2004 :: Business Rules Engine :: missing elements crash engine
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > BizTalk Server > BizTalk Server Orchestration > BizTalk 2004 :: Business Rules Engine :: missing elements crash engine




Pages (2): [1] 2 »   Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    BizTalk 2004 :: Business Rules Engine :: missing elements crash engine  
BA


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-23-05 12:49 PM

Hello everyone,

I have experienced this limitation a number of times with the rules engine
and have found very little about it when searching google:

When you pass in an xml document with an element that is missing it causes
the rules engine to throw an error.

This is causing my development team quite a hassle.

We have considered a default blank space in the rules engine elements, but
this causes mapping problems when looping, creating blank elemented nodes
where we dont want them.

We tried the "EXISTS" predicate coupled with an "AND" condition but it
evaluates all the condition and doesnt seem to stop at the first failing
condition, the "EXISTS" condition.

The "HALT" function doesnt seem able to stop halt a specific rule, rather it
halts the entire policy execution.

Can someone please offer us a workaround for this problem?

Thanks in advance,

BA







[ Post a follow-up to this message ]



    Re: BizTalk 2004 :: Business Rules Engine :: missing elements crash engine  
esuyer@gmail.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-23-05 10:52 PM

Just venturing a guess here

Have you tried adding a condition like this

If  ElementA is not null
AND ElementA is equal to "foo"

I believe this way, it will not get to this predicate (the failing
predicate)  <ElementA is equal to "foo"> , unless this predicate
<ElementA is not null> passes

Can you give an xml sample and what your rule looks like

Also what's the error you get?  And what happens when you use EXISTS?






[ Post a follow-up to this message ]



    Re: BizTalk 2004 :: Business Rules Engine :: missing elements crash engine  
Matt Milner


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-23-05 10:52 PM

I have seen this behavior, but it had to do with the fact that the exists
predicate was evaluating the xpath and if it found the item in any record it
was true.  The problem was with the xpath selector and alias that we were
using for the exists.

I'd test just your exists to make sure you get the following results with
multiple records in your xml:
- if the element does not exist in any you should get false for all items.
If you have a bug, this should still work. I.E. your rules should not try to
evaluate the second part of the and as the exists will return false.
-if all of your elemements exists then you should get true for all items.
Again, if you have a bug, this should still work as the exists evaluates
once to true and then they all get set.
- if only some of the items have the element, then you should get those
correctly set.  This is where your bug is catching you if it is evaluating
the exists only once.

By the way, it is easy to view the output of testing or running the policy
and check how many times the exists condition evaluates if you use scenario
1 or 2 above to test.  Then you can see if this is truly your problem and
begin modifying the xpath.  Also note that the default document selected
(the second argument in the exists predicate) may not be as specific as you
want so you might need to update it as well.  The basic test will be the
xpath on the left run from the context of the element/record on the right.

Matt


"BA" <biztalk.architect@gmail.com> wrote in message
news:%23PHUXVDwFHA.708@TK2MSFTNGP10.phx.gbl...
> Hello everyone,
>
> I have experienced this limitation a number of times with the rules engine
> and have found very little about it when searching google:
>
> When you pass in an xml document with an element that is missing it causes
> the rules engine to throw an error.
>
> This is causing my development team quite a hassle.
>
> We have considered a default blank space in the rules engine elements, but
> this causes mapping problems when looping, creating blank elemented nodes
> where we dont want them.
>
> We tried the "EXISTS" predicate coupled with an "AND" condition but it
> evaluates all the condition and doesnt seem to stop at the first failing
> condition, the "EXISTS" condition.
>
> The "HALT" function doesnt seem able to stop halt a specific rule, rather
> it
> halts the entire policy execution.
>
> Can someone please offer us a workaround for this problem?
>
> Thanks in advance,
>
> BA
>
>







[ Post a follow-up to this message ]



    Re: BizTalk 2004 :: Business Rules Engine :: missing elements crash engine  
BA


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-26-05 12:49 PM

Hi Matt, thanks for the help.

Your suggestions do help but we are stuck getting the rule to return true
when the node we want exists.

I'm able now to see the rule evaluating more than once but we keep getting
false negatives, IE, when the node exists it still evaluates to false.

Here is a test sample of XML we created to test this, it looks like:

<root>
<person>
<lastName>Doe</lastName>
</person>
<person>
<firstName>John</firstName>
<lastName>Smith</lastName>
</person>
<person>
<lastName>Foo</lastName>
</person>
</root>

We want to loop the person nodes searching for firstName nodes.

I made a vocabulary entry for the firstName node and changed the Xpath from:

/*[local-name()='Root' and
namespace-uri()='http://RuleExistenceTest.Schema1']/*[local-name()='Pers
on'
and namespace-uri()='']

to

/*[local-name()='Person' and namespace-uri()='']

And made the Xpath field just a '.' (no quotes)


The EXISTS rule looks like:

If <<vocab_firstName>> exists in <<Schema1:/root/Person>>

The right side was achieved by dragging the person node to the xml document
place holder, we also tried making the right side a vocab entry and modified
the path, again no results.

We've tried about 75 different variations on this theme with no results.
The rule is never able to match the node when the firstName exists.

I could use some direction, your post was very helpful getting us on the
right track as was this posting:

http://blogs.msdn.com/skaufman/arch.../30/344313.aspx

But we cant figure out the correct combination or correct setup for
executing the rule.

Thanks again,

BA


"Matt Milner" <matt.milner@m3technologypartners dot com> wrote in message
news:easdC0FwFHA.3000@TK2MSFTNGP12.phx.gbl...
> I have seen this behavior, but it had to do with the fact that the exists
> predicate was evaluating the xpath and if it found the item in any record
it
> was true.  The problem was with the xpath selector and alias that we were
> using for the exists.
>
> I'd test just your exists to make sure you get the following results with
> multiple records in your xml:
> - if the element does not exist in any you should get false for all items.
> If you have a bug, this should still work. I.E. your rules should not try
to
> evaluate the second part of the and as the exists will return false.
> -if all of your elemements exists then you should get true for all items.
> Again, if you have a bug, this should still work as the exists evaluates
> once to true and then they all get set.
> - if only some of the items have the element, then you should get those
> correctly set.  This is where your bug is catching you if it is evaluating
> the exists only once.
>
> By the way, it is easy to view the output of testing or running the policy
> and check how many times the exists condition evaluates if you use
scenario
> 1 or 2 above to test.  Then you can see if this is truly your problem and
> begin modifying the xpath.  Also note that the default document selected
> (the second argument in the exists predicate) may not be as specific as
you
> want so you might need to update it as well.  The basic test will be the
> xpath on the left run from the context of the element/record on the right.
>
> Matt
>
>
> "BA" <biztalk.architect@gmail.com> wrote in message
> news:%23PHUXVDwFHA.708@TK2MSFTNGP10.phx.gbl... 
engine[vbcol=seagreen] 
causes[vbcol=seagreen] 
but[vbcol=seagreen] 
nodes[vbcol=seagreen] 
rather[vbcol=seagreen] 
>
>







[ Post a follow-up to this message ]



    Re: BizTalk 2004 :: Business Rules Engine :: missing elements crash engine  
esuyer@gmail.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-26-05 12:49 PM

BA,

I plugged the exact XML sample you sent into XMLSpy and tested a few
different XPath expression variations.  With the sample you sent

/*[local-name()='root']/*[local-name()='person']/*[local-name()=
'firstName']

returned John

The expression is case sensetive (and again matches the exact sample
you sent ... not sure if this is the actual xml or something you just
mocked up for this post).  So that being said, I think your definition
of vocab_firstName needs to be

XPath Selector:
/*[local-name()='root']/*[local-name()='person']

XPath Field:

/*[local-name()='firstName']

or

XPath Selector:
/*[local-name()='root']

XPath Field:

/*[local-name()='person']/*[local-name()='firstName']

depending on how you intend to use it.  But in both instances I believe
you should be able to use predicates like:

vocab_FirstName is equal to John
vocab_FirstName exists in Schema
vocab_FirstName is not null

w/o issue.

If you're not already doing so, I recommend you work through this
problem in the business rules composer using test policy.  I find that
it's much easier to isolate the problem this way.

HTH






[ Post a follow-up to this message ]



    Re: BizTalk 2004 :: Business Rules Engine :: missing elements crash engine  
BA


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-26-05 10:59 PM

Hey HTH,

I tried your suggestion but the true result is returned without looping thru
the records.

That Xpath and selector and field combination is valid but in essence it is
saying "I have a true result in one or more of the 'person' nodes" which
will breakdown when setting values becuase it will attempt to traverse all
the person nodes, not individual nodes that have the firstName node.

I confirmed this and recieved the "Field 'x' does not exist in the xml
document" error.

I appreciate your help and hope you understand where I am still stuck.  If
you do, any help would be greatly appreciated.  We've burned up quite a few
hours dealing with this.

Cheers,
BA

PS, yes, the sample was just a record I mocked up, I'm using the test
feature in the composer as well




<esuyer@gmail.com> wrote in message
news:1127738181.053686.283770@g47g2000cwa.googlegroups.com...
> BA,
>
> I plugged the exact XML sample you sent into XMLSpy and tested a few
> different XPath expression variations.  With the sample you sent
>
>
/*[local-name()='root']/*[local-name()='person']/*[local-name()='firstName'][vbc
ol=seagreen]
>
> returned John
>
> The expression is case sensetive (and again matches the exact sample
> you sent ... not sure if this is the actual xml or something you just
> mocked up for this post).  So that being said, I think your definition
> of vocab_firstName needs to be
>
> XPath Selector:
> /*[local-name()='root']/*[local-name()='person']
>
> XPath Field:
>
> /*[local-name()='firstName']
>
> or
>
> XPath Selector:
> /*[local-name()='root']
>
> XPath Field:
>
> /*[local-name()='person']/*[local-name()='firstName']
>
> depending on how you intend to use it.  But in both instances I believe
> you should be able to use predicates like:
>
> vocab_FirstName is equal to John
> vocab_FirstName exists in Schema
> vocab_FirstName is not null
>
> w/o issue.
>
> If you're not already doing so, I recommend you work through this
> problem in the business rules composer using test policy.  I find that
> it's much easier to isolate the problem this way.
>
> HTH
>[/vbcol]







[ Post a follow-up to this message ]



    Re: BizTalk 2004 :: Business Rules Engine :: missing elements crash engine  
esuyer@gmail.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-26-05 10:59 PM

Try

Selector:
/*[local-name()=3D'root']/*[local-name()=3D'person'][firstName]

Field
@*[local-name()=3D'firstName'=AD]

This should only return person nodes w/ a firstName






[ Post a follow-up to this message ]



    Re: BizTalk 2004 :: Business Rules Engine :: missing elements crash engine  
Matt Milner


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-26-05 10:59 PM

I'd try something like this based on what you have said:

For the first name element, use this:
Selector:  /*[local-name()='Root' and
namespace-uri()='http://RuleExistenceTest.Schema1']
Path: *local-name()='Person' and
namespace-uri()='']/*local-name()='firstname' and namespace-uri()='']

Then use the exists and drag the first name element onto the left side, then
drag the person element onto the right side.

I'm assuming here that the namespace and structure are accurate in your
example and that you are looking for items with the first name present.

If you want to send me the schema, or similar example schema, off line, I
can shoot you back a working policy with a rule that does the exists
correctly.

Matt



"BA" <biztalk.architect@gmail.com> wrote in message
news:%23OjlelowFHA.3692@TK2MSFTNGP11.phx.gbl...
> Hi Matt, thanks for the help.
>
> Your suggestions do help but we are stuck getting the rule to return true
> when the node we want exists.
>
> I'm able now to see the rule evaluating more than once but we keep getting
> false negatives, IE, when the node exists it still evaluates to false.
>
> Here is a test sample of XML we created to test this, it looks like:
>
> <root>
>     <person>
>        <lastName>Doe</lastName>
>    </person>
>     <person>
>        <firstName>John</firstName>
>        <lastName>Smith</lastName>
>    </person>
>     <person>
>        <lastName>Foo</lastName>
>    </person>
> </root>
>
> We want to loop the person nodes searching for firstName nodes.
>
> I made a vocabulary entry for the firstName node and changed the Xpath
> from:
>
> /*[local-name()='Root' and
> namespace-uri()='http://RuleExistenceTest.Schema1']/*[local-name()='Pe
rson'
> and namespace-uri()='']
>
> to
>
> /*[local-name()='Person' and namespace-uri()='']
>
> And made the Xpath field just a '.' (no quotes)
>
>
> The EXISTS rule looks like:
>
> If <<vocab_firstName>> exists in <<Schema1:/root/Person>>
>
> The right side was achieved by dragging the person node to the xml
> document
> place holder, we also tried making the right side a vocab entry and
> modified
> the path, again no results.
>
> We've tried about 75 different variations on this theme with no results.
> The rule is never able to match the node when the firstName exists.
>
> I could use some direction, your post was very helpful getting us on the
> right track as was this posting:
>
> http://blogs.msdn.com/skaufman/arch.../30/344313.aspx
>
> But we cant figure out the correct combination or correct setup for
> executing the rule.
>
> Thanks again,
>
> BA
>
>
> "Matt Milner" <matt.milner@m3technologypartners dot com> wrote in message
> news:easdC0FwFHA.3000@TK2MSFTNGP12.phx.gbl... 
> it 
> to 
> scenario 
> you 
> engine 
> causes 
> but 
> nodes 
> rather 
>
>







[ Post a follow-up to this message ]



    Re: BizTalk 2004 :: Business Rules Engine :: missing elements crash engine  
BA


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-27-05 12:57 PM

I tried your suggestion but it fails to select only the nodes which contain
a firstName node.

In a Xpath selector tool it does work but inside the rules engine it
generates another error message.


<esuyer@gmail.com> wrote in message
news:1127761489.026541.165280@f14g2000cwb.googlegroups.com...
Try

Selector:
/*[local-name()='root']/*[local-name()='person'][firstName]

Field
@*[local-name()='firstName'_]

This should only return person nodes w/ a firstName







[ Post a follow-up to this message ]



    Re: BizTalk 2004 :: Business Rules Engine :: missing elements crash engine  
BA


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-27-05 12:57 PM


Hey Matt,

Correct, I am only looking for items with the first name present.

I tried your suggestion and some variations but I am again unable to
correctly select records which only have the first name present.

The real document I have to deal with has hundreds of fields, so this sample
was an attempt to get a simple model working.

I'll mail you what I have.  Again, I appreciate the help.

BA

"Matt Milner" <matt.milner@m3technologypartners dot com> wrote in message
news:OM7B%23XtwFHA.2880@TK2MSFTNGP12.phx.gbl...
> I'd try something like this based on what you have said:
>
> For the first name element, use this:
> Selector:  /*[local-name()='Root' and
> namespace-uri()='http://RuleExistenceTest.Schema1']
> Path: *local-name()='Person' and
> namespace-uri()='']/*local-name()='firstname' and namespace-uri()='']
>
> Then use the exists and drag the first name element onto the left side,
then
> drag the person element onto the right side.
>
> I'm assuming here that the namespace and structure are accurate in your
> example and that you are looking for items with the first name present.
>
> If you want to send me the schema, or similar example schema, off line, I
> can shoot you back a working policy with a rule that does the exists
> correctly.
>
> Matt
>
>
>
> "BA" <biztalk.architect@gmail.com> wrote in message
> news:%23OjlelowFHA.3692@TK2MSFTNGP11.phx.gbl... 
true[vbcol=seagreen] 
getting[vbcol=seagreen] 
namespace-uri()='http://RuleExistenceTest.Schema1']/*[local-name()='Person'[vbcol=seagre
en] 
message[vbcol=seagreen] 
exists[vbcol=seagreen] 
record[vbcol=seagreen] 
were[vbcol=seagreen] 
with[vbcol=seagreen] 
try[vbcol=seagreen] 
items.[vbcol=seagreen] 
evaluates[vbcol=seagreen] 
and[vbcol=seagreen] 
selected[vbcol=seagreen] 
the[vbcol=seagreen] 
elements,[vbcol=seagreen] 
it[vbcol=seagreen] 
>
>







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 08:10 PM.      Post New Thread    Post A Reply      
Pages (2): [1] 2 »   Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register