If I remember correctly, if you want to address the nth element of a
node-set you need to use the built-in position() context function, e.g.,

field[position() = $index]

alex


On Tue, Jan 20, 2009 at 8:02 PM, ZHAO Wenfeng <[email protected]> wrote:

> Hello,
>
>    I need fill a reply message which contains an array. But my BPEL process
> doesn't work in ODE 2.0 when the index of the array in <to> section of the
> assign activity takes a variable of type xsd:unsignedInt which has been
> correctly intialized.
>
> The BPEL piece in question is:
>
>                    <assign>
>                      <copy>
>                        <from><literal
> xsi:type="xsd:unsignedInt">2</literal></from>
>                        <to variable="_i1"/>
>                      </copy>
>                      <copy>
>                        <from><literal
> xsi:type="xsd:string">hello</literal></from>
>                        <to>$output0.body/xsd0:field1[$_i1]</to>  <!-- It'll
> be OK if $_i1 here is replaced with number 2 -->
>                      </copy>
>                    </assign>
>
> ODE 2.0 Build #87 (2009-1-8 2:25:04)  reports an error for it as:
>
> 03:32:00,062 ERROR [ASSIGN] Assignment Fault: {
> http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure,lineNo=155,faultExplanation={http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure<http://docs.oasis-open.org/wsbpel/2.0/process/executable%7DselectionFailure,lineNo=155,faultExplanation=%7Bhttp://docs.oasis-open.org/wsbpel/2.0/process/executable%7DselectionFailure>:
> Multiple results for expression: {OXPath10Expression
> $output0.body/xsd0:field1[$_i1]}
>
>
> When I simply replace the variable with a number as the comments above
> says, ODE works well.
>
> What's the problem? The WS-BPEL 2.0 specification says that "...
> expressions that conform to the XPath 1.0 Expr production" in the section
> "8.3.5. General Expressions". And in XPath recommendation, "Expr" production
> allows "VariableReference" as the element position of a predicate. So is it
> a BUG of ODE ?
>
> --------------
> FYR, the schema of the $output0.body is as follows:
>    <types>
>       <schema targetNamespace="http://example.com/request21.xsd";
>              xmlns="http://www.w3.org/2000/10/XMLSchema";
>              elementFormDefault="qualified" >
>
>           <element name="RequestInfo" type="string"/>
>
>           <element name="ResultInfo">
>              <complexType>
>                  <sequence>
>                      <element name="field1" type="string"
> maxOccurs="unbounded"/>
>                  </sequence>
>              </complexType>
>           </element>
>       </schema>
>    </types>
>
>    <message name="Request21OpOutput">
>        <part name="body" element="xsd1:ResultInfo"/>
>    </message>
>
> In the BPEL file:
>    <variable name="output0" messageType="ws0:Request21OpOutput" />
>
> --------------
>
>
> Best Regards
>
> Wenfeng
>
>
>

Reply via email to