Hi Sebastien, Could you open a bug report (in Jira) with a full BPEL illustrating this issue? We have a few test cases in SVN that work with <forEach> and the counter variable, so you must be doing something different. Are you using BPEL 1.1 / 2.0 ?
alex On 1/6/08, SŽebastien Mosser <[EMAIL PROTECTED]> wrote: > > Hello everybody. > > I'm trying to iterate over a sequence (which came from a third-party > partner response message), filling the output of a process I'm writing. > > > here is my forEach loop definition : > > <bpws:forEach > counterName="Counter" > name="IterateOverResults" > parallel="no"> > > <bpws:startCounterValue> > <![CDATA[1]]> > </bpws:startCounterValue> > <bpws:finalCounterValue> > <![CDATA[count($feedReaderResponse.parameters/xsd:return/xsd:content)]]> > </bpws:finalCounterValue> > > <bpws:scope> > <bpws:assign name="AddResultToOutput" validate="no"> > <bpws:copy> > > <bpws:from><![CDATA[$feedReaderResponse.parameters/xsd:return/xsd:content[$Counter]/xsd:content]]></bpws:from> > > <bpws:to><![CDATA[$output.payload/tns:result[$Counter]/tns:htmlContent]]></bpws:to> > </bpws:copy> > </bpws:assign> > </bpws:scope> > </bpws:forEach> > > I'm quite not sure of my XPath Expressions as I'm (really) far from an > expert, but as far as I understand BPEL specification, the counter > variable (basically $Counter) should be implicitly accessible inside the > loop. > > Or, when I 'bpel-compile' my process, the compiler fails : > [exec] null:90: error: [UndeclaredVariable] Attempt to reference > undeclared variable "Counter". > [exec] null:95: error: [UndeclaredVariable] Attempt to reference > undeclared variable "Counter". > [exec] java org.apache.ode.tools.bpelc.cline.BpelC: null > [exec] java.lang.NullPointerException > [exec] at > org.apache.ode.bpel.o.OForEach.toString(OForEach.java:41) > [exec] at java.lang.String.valueOf(String.java:2615) > [exec] at java.lang.StringBuilder.append(StringBuilder.java:116) > [exec] at > org.apache.ode.bpel.compiler.BpelCompiler.compile(BpelCompiler.java:839) > [exec] at > org.apache.ode.bpel.compiler.SequenceGenerator.compileChildren( > SequenceGenerator.java:47) > [exec] at > org.apache.ode.bpel.compiler.SequenceGenerator.compile( > SequenceGenerator.java:41) > [exec] at > org.apache.ode.bpel.compiler.BpelCompiler$7.run(BpelCompiler.java:882) > [exec] at > org.apache.ode.bpel.compiler.BpelCompiler.compile(BpelCompiler.java:1045) > [exec] at > org.apache.ode.bpel.compiler.BpelCompiler.compileActivity( > BpelCompiler.java:878) > [exec] at > org.apache.ode.bpel.compiler.BpelCompiler.compile(BpelCompiler.java:831) > [exec] at > org.apache.ode.bpel.compiler.BpelCompiler$5.run(BpelCompiler.java:708) > [exec] at > org.apache.ode.bpel.compiler.BpelCompiler$8.run(BpelCompiler.java:1139) > [exec] at > org.apache.ode.bpel.compiler.BpelCompiler.compile(BpelCompiler.java:1045) > [exec] at > org.apache.ode.bpel.compiler.BpelCompiler.compileScope(BpelCompiler.java > :1089) > [exec] at > org.apache.ode.bpel.compiler.BpelCompiler.compile(BpelCompiler.java:688) > [exec] at > org.apache.ode.bpel.compiler.BpelC.compile(BpelC.java:260) > [exec] at > org.apache.ode.bpel.compiler.BpelC.compile(BpelC.java:330) > [exec] at > org.apache.ode.tools.bpelc.BpelCompileCommand.execute( > BpelCompileCommand.java:121) > [exec] at > org.apache.ode.tools.bpelc.cline.BpelC.main(BpelC.java:99) > > So, I guess that my XPath is wrong, but It should be possible to access > to $Counter inside it however ... > > Any ideas ? > > Cheers, > > -- > Sebastian >
