On Mon, Apr 13, 2009 at 9:55 AM, Jonathan Coogan < [email protected]> wrote:
> Thank you. I'm not actually trying to use the process for anything > meaningful. I was trying to illustrate the behavior I noticed when using > query expressions within a forEach loop. It's entirely possible that there > is something wrong with my process, but I do know that one snippet works > and > the other doesn't. I'll see if I can come up with a simpler example. > Looking at the compiler I haven't found anything obvious that could explain your behavior so yes, a test case would help identifying the problem. Also does it only happen within a forEach or do you get the same problem when you use the query element outside of a forEach? Thanks, Matthieu > > -Jon > > > On 4/13/09 9:02 AM, "Ford, Mark" <[email protected]> wrote: > > > You're saying that there is a difference in behavior between an > expression > > to-spec and a query to-spec. The example you provided looks the same > > semantically and only differs in syntax. My suggestion is to produce a > simpler > > test case that shows this behavior and submit it as a bug if it still > fails. > > > > The use of the forEach below (and the expressionLanguage attributes and > CDATA > > nodes) is overly complicated. You may also be running into a subtle issue > > (possibly still an open bug) with the use of the forEach counter variable > > within a predicate. I believe you need to wrap the variable usage within > a > > number() function. > > > > I'm also assuming that the forEach below was only a portion of your > actual > > process and that you're doing something more than iterating over assigns > with > > a forEach. For example, you probably have an invoke somewhere in the real > > code. While the snippet below is valid BPEL (at least at a quick glance) > it's > > not a good use case for the forEach. The code below would be better > > accomplished in an Xquery FLWOR expression. Again - apologies if it's > just to > > illustrate the bug - just mentioning it in case it was the real thing. > > > > > > > > On 4/13/09 11:33 AM, "Jonathan Coogan" <[email protected]> > wrote: > > > > I'm still stuck on this. Does anyone have any suggestions? Should I > write > > a bug report? > > > > Thank you. > > -Jon > > > > > > On 4/7/09 10:30 AM, "Jon Coogan" <[email protected]> wrote: > > > >> Here is a similar scenario that doesn't work in either 1.2 or 1.X. In > >> this example I iterate over record set and copy each record to an > >> intermediate temp variable. Then I assign from the temp variable to the > >> output variable. The process should return the value from the last > >> record. > >> > >> The problem occurs when copying from the dataset to the temporary > >> variable. If I use a query on the "to" side it won't work. Expressions > >> do work. (Look for inline comments below.) > >> > >> > >> <bpws:forEach counterName="Counter" name="ForEach" parallel="no"> > >> <bpws:startCounterValue > >> expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![C > >> DATA[1]]></bpws:startCounterValue> > >> <bpws:finalCounterValue > >> expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![C > >> DATA[count($Data/ns0:Record)]]></bpws:finalCounterValue> > >> <bpws:scope> > >> <bpws:sequence name="Sequence"> > >> <bpws:assign name="AssignToTempVariable" validate="no"> > >> <bpws:copy> > >> <bpws:from> > >> <!-- Initialize temp variable. --> > >> <bpws:literal> > >> <tns:Record xmlns:tns="recordsnamespace" > >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > >> xsi:schemaLocation="recordsnamespace records.xsd "> > >> <tns:SomeValue/> > >> <tns:AnotherValue/> > >> </tns:Record> > >> </bpws:literal> > >> </bpws:from> > >> <bpws:to variable="TempRecord"/> > >> </bpws:copy> > >> > >> > >> <!-- ********** This does not work. ********** --> > >> > >> <bpws:copy> > >> <bpws:from variable="Data"> > >> <bpws:query > >> queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![CDATA[ > >> ns0:Record[$Counter]/ns0:SomeValue]]></bpws:query> > >> </bpws:from> > >> <bpws:to variable="TempRecord"> > >> <bpws:query > >> queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![CDATA[ > >> ns0:SomeValue]]></bpws:query> > >> </bpws:to> > >> </bpws:copy> > >> <bpws:copy> > >> <bpws:from variable="Data"> > >> <bpws:query > >> queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![CDATA[ > >> ns0:Record[$Counter]/ns0:AnotherValue]]></bpws:query> > >> </bpws:from> > >> <bpws:to variable="TempRecord"> > >> <bpws:query > >> queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![CDATA[ > >> ns0:AnotherValue]]></bpws:query> > >> </bpws:to> > >> </bpws:copy> > >> > >> <!-- ********** This does work. ********** --> > >> > >> <bpws:copy> > >> <bpws:from variable="Data"> > >> <bpws:query > >> queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![CDATA[ > >> ns0:Record[$Counter]/ns0:SomeValue]]></bpws:query> > >> </bpws:from> > >> <bpws:to > >> expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![C > >> DATA[$TempRecord/ns0:SomeValue]]></bpws:to> > >> </bpws:copy> > >> <bpws:copy> > >> <bpws:from variable="Data"> > >> <bpws:query > >> queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![CDATA[ > >> ns0:Record[$Counter]/ns0:AnotherValue]]></bpws:query> > >> </bpws:from> > >> <bpws:to > >> expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![C > >> DATA[$TempRecord/ns0:AnotherValue]]></bpws:to> > >> </bpws:copy> > >> > >> > >> </bpws:assign> > >> <bpws:assign name="AssignToOutput" validate="no"> > >> <bpws:copy> > >> <bpws:from variable="TempRecord"> > >> <bpws:query > >> queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![CDATA[ > >> ns0:AnotherValue]]></bpws:query> > >> </bpws:from> > >> <bpws:to part="payload" variable="output"/> > >> </bpws:copy> > >> </bpws:assign> > >> </bpws:sequence> > >> </bpws:scope> > >> </bpws:forEach> > >> > >> -----Original Message----- > >> From: Jonathan Coogan [mailto:[email protected]] > >> Sent: Tuesday, April 07, 2009 9:56 AM > >> To: [email protected]; [email protected] > >> Subject: RE: Problem with query expressions > >> > >> Hello. I have confirmed that using a relative query fixes the problem > >> in my Ode 1.X build, but this still does not work for me in Ode 1.2. > >> After switching to a relative query I am no longer getting a selection > >> failure, but the process is returning erroneous output. It returns the > >> entire dataset instead of just the element I was trying to query. > >> > >> <bpws:forEach counterName="Counter" name="ForEach" parallel="no"> > >> <bpws:startCounterValue > >> expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![C > >> DATA[1]]></bpws:startCounterValue> > >> <bpws:finalCounterValue > >> expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![C > >> DATA[count($Data/ns0:Record)]]></bpws:finalCounterValue> > >> <bpws:scope> > >> <bpws:assign validate="no"> > >> > >> <!-- This does not work in Ode 1.2 but it does work in Ode 1.X --> > >> <bpws:copy> > >> <bpws:from variable="Data"> > >> <bpws:query > >> queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![CDATA[ > >> ns0:Record[$Counter]/ns0:AnotherValue]]></bpws:query> > >> </bpws:from> > >> <bpws:to part="payload" variable="output"/> > >> </bpws:copy> > >> > >> <!-- This works.. --> > >> <bpws:copy> > >> <bpws:from > >> expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![C > >> DATA[$Data/ns0:Record[$Counter]/ns0:AnotherValue]]></bpws:from> > >> <bpws:to part="payload" variable="output"/> > >> </bpws:copy> > >> > >> </bpws:assign> > >> </bpws:scope> > >> </bpws:forEach> > >> > >> Is there something else I could be missing? > >> > >> Thanks. > >> -Jon > >> > >> -----Original Message----- > >> From: Matthieu Riou [mailto:[email protected]] > >> Sent: Friday, April 03, 2009 8:07 AM > >> To: [email protected] > >> Subject: Re: Problem with query expressions > >> > >> On Thu, Apr 2, 2009 at 2:46 PM, Jonathan Coogan < > >> [email protected]> wrote: > >> > >>> Hi. I'm having a problem when copying data from one variable to > >>> another within a forEach loop. When I use a query to copy data out of > >> > >>> a variable I get a selection failure fault at runtime. This works > >>> correctly when I copy from an expression instead of a query. > >>> > >>> I have attached an example that demonstrates the problem. The > >>> expected output of the attached BPEL process is the string "five". It > >> > >>> works correctly when using an expression, but fails when using a > >>> query. Here is the relevant snippet: > >>> > >> > >> BPEL assignment doesn't provide any context node to the XPath engine, > >> everything is always relative to a variable. Which means that your query > >> should be relative and not absolute. > >> > >> Matthieu > >> > >> > >>> > >>> <bpws:forEach counterName="Counter" name="ForEach" parallel="no"> > >>> <bpws:startCounterValue > >>> > >> expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![C > >> DATA[1]]></bpws:startCounterValue> > >>> <bpws:finalCounterValue > >>> > >> expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![C > >> DATA[count($Data/ns0:Record)]]></bpws:finalCounterValue> > >>> <bpws:scope> > >>> <bpws:assign validate="no"> > >>> <bpws:copy> > >>> <!-- > >>> ---------------------------------------------------------------------- > >>> ------ > >>> --> > >>> <!-- This generates a selection failure at runtime. --> > >>> <bpws:from variable="Data"> > >>> <bpws:query > >>> > >> queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![CDATA[ > >> /ns0:Record[$Counter]/ns0:SomeValue]]></bpws:query> > >>> </bpws:from> > >>> > >>> <!-- This works. --> > >>> <!-- <bpws:from > >>> expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><! > >>> [CDATA[$Data/ns0:Record[$Counter]/ns0:SomeValue]]></bpws:from> > >>> --> > >>> <!-- > >>> ---------------------------------------------------------------------- > >>> ------ > >>> --> > >>> > >>> <bpws:to part="payload" variable="output"/> > >>> </bpws:copy> > >>> </bpws:assign> > >>> </bpws:scope> > >>> </bpws:forEach> > >>> > >>> I have tested this with Ode 1.2 and a recent build of Ode 1.X and both > >> > >>> behave the same. Can someone tell me if I am doing something wrong? > >>> Or should I write a bug report for this? > >>> > >>> Thanks for your time. > >>> -Jon > >>> > > > > > > > > > > > > > >
