"No result for expression ... " does not mean "$i does not work in XPath predicate expression".
http://ode.apache.org/faq.html *Q.* *My process fails with a selectionFailure; What can I do?* *A.* BPEL expects a *single* element to be selected when evaluating <to> and <from> expressions, and a selectionFailure fault is thrown if zero or more than one element are selected. If you get zero element, double-check your namespace prefix and bindings. Also, remember that you must initialize your variables (most often with <literal>'s) before assigning into them, unless your are reassigning the whole variable (e.g. directly into $variable, or $variable.part). To debug assignments, you can set the "org.apache.ode" logging category to DEBUG in order to see the content of variables as the process executes. 2009/1/21 ZHAO Wenfeng <[email protected]> > Hi all, > I found another BUG-like problem in ODE 2.0 Build #87 (2009-1-8 2:25:04). > That is: the counterName variable can't be used in the position expression > of XPath as normal variables are. For example, the following BPEL piece > <forEach counterName="i" parallel="no"> > <startCounterValue>1</startCounterValue> > <finalCounterValue>2</finalCounterValue> > <scope> > <assign> > <copy> > <from>$i</from> > <to>$output0.body/xsd0:field1[position()=$i]</to> > <!-- note this line --> > </copy> > </assign> > </scope> > </forEach> > will incur such ERROR in ODE: > > ERROR - GeronimoLog.error(104) | Assignment Fault: { > http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure,lineNo=149,faultExplanation={http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure<http://docs.oasis-open.org/wsbpel/2.0/process/executable%7DselectionFailure,lineNo=149,faultExplanation=%7Bhttp://docs.oasis-open.org/wsbpel/2.0/process/executable%7DselectionFailure>: > No results for expression: {OXPath10Expression > $output0.body/xsd0:field1[position()=$i]} > 12:39:37,781 ERROR [ASSIGN] Assignment Fault: { > http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure,lineNo=149,faultExplanation={http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure<http://docs.oasis-open.org/wsbpel/2.0/process/executable%7DselectionFailure,lineNo=149,faultExplanation=%7Bhttp://docs.oasis-open.org/wsbpel/2.0/process/executable%7DselectionFailure>: > No results for expression: {OXPath10Expression > $output0.body/xsd0:field1[position()=$i]} > > > But when I simply replace $i with a normal unsignedInt variable $_i1, > turning the piece above into: > <forEach counterName="i" parallel="no"> > <startCounterValue>1</startCounterValue> > <finalCounterValue>2</finalCounterValue> > <scope> > <assign> > <copy> > <from variable="i" /> > <to variable="_i1"/> > </copy> > <copy> > <from>$i</from> > <to>$output0.body/xsd0:field1[position()=$_i1]</to> > <!-- note this line --> > </copy> > </assign> > </scope> > </forEach> > it works fine! How strange! The expression language and query language used > are both the default one, i.e. XPath 1.0. > > Need I commit a bug report to the developers of ODE? :-) > > Thanks & Regards. > Wenfeng > > > > ZHAO Wenfeng > [email protected] > 2009-01-21 >
