Hi Matthieu Riou,

I've had a solution. That is using 
    $array/item[position() = $index] 
instead of
    $array/item[$index]
, just as Alex said.

Thanks&Regards.
Wenfeng


======= 2009-01-21 23:50:58 您在来信中写道:=======

>Can you try without the literal? So just:
>
>     <copy>
>       <from>2</from>
>        <to variable="_i1"/>
>     </copy>
>
>By the way you shouldn't declare any xsi:type.
>
>Thanks,
>Matthieu
>
>
>On Wed, Jan 21, 2009 at 3:37 AM, ZHAO Wenfeng <[email protected]> wrote:
>
>> Hello Alex Boisvert,
>>    Thanks for your answer!
>>    You are right when the XPath 1.0 (i.e. the default expression language)
>> is used when "field1[position()=$_i1]" is OK but "field1[$_i1]" doesn't
>> work.
>>
>>    But when I use XPath 2.0 instead, the expression
>> "<to>$output0.body/xsd0:field1[fn:position()=$_i1]</to>" doesn't work too
>> (here xmlns:fn="http://www.w3.org/2005/xpath-functions";). ODE reports
>> error as:
>>
>> ERROR - GeronimoLog.error(104) | Assignment Fault: ERROR -
>> GeronimoLog.error(104) | Assignment Fault: {
>> http://docs.oasis-open.org/wsbpel/2.0/process/executable}subLanguageExecutionFault,lineNo=147,faultExplanation={http://docs.oasis-open.org/wsbpel/2.0/process/executable}subLanguageExecutionFault<http://docs.oasis-open.org/wsbpel/2.0/process/executable%7DsubLanguageExecutionFault,lineNo=147,faultExplanation=%7Bhttp://docs.oasis-open.org/wsbpel/2.0/process/executable%7DsubLanguageExecutionFault>:
>> null
>> 11:23:45,046 ERROR [ASSIGN] Assignment Fault: {
>> http://docs.oasis-open.org/wsbpel/2.0/process/executable}subLanguageExecutionFault,lineNo=147,faultExplanation={http://docs.oasis-open.org/wsbpel/2.0/process/executable}subLanguageExecutionFault<http://docs.oasis-open.org/wsbpel/2.0/process/executable%7DsubLanguageExecutionFault,lineNo=147,faultExplanation=%7Bhttp://docs.oasis-open.org/wsbpel/2.0/process/executable%7DsubLanguageExecutionFault>:
>> null
>>
>> And when $_i1 is replaced with the number 2, it is OK!
>>
>> Now it seems to be a BUG, doesn't it?
>>
>> ---------------
>> BPEL pieces in question FYR:
>>
>> <process name="SolutionProcess_q21_sol1"
>>             ... ...
>>             xmlns:xsd0="http://example.com/request21.xsd";
>>             queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
>>
>> expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
>>             xmlns:fn="http://www.w3.org/2005/xpath-functions";
>>             >
>>    ... ...
>>    <variable name="_i1" type="xsd:positiveInteger" />
>>    ... ...
>>    <assign>
>>      <copy>
>>        <from><literal>
>>            <xsd0:ResultInfo>
>>              <xsd0:field1 >haha </xsd0:field1>
>>              <xsd0:field1 >hehe </xsd0:field1>
>>            </xsd0:ResultInfo>
>>        </literal></from>
>>        <to>$output0.body</to>
>>      </copy>
>>
>>      <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[fn:position()=$_i1]</to>   <!-- It'll
>> be OK if $_i1 here is replaced with number 2 -->
>>      </copy>
>>    </assign>
>>
>> -------------------
>>
>> Best Regards
>>
>> Wenfeng
>>
>> ======= 2009-01-21 13:24:49 您在来信中写道:=======
>>
>> >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>
>> <
>> 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
>> >>
>> >>
>> >>
>>
>> = = = = = = = = = = = = = = = = = = = =
>>
>>
>> 致
>> 礼!
>>
>>
>> ZHAO Wenfeng
>> [email protected]
>>  2009-01-21
>>
>>

= = = = = = = = = = = = = = = = = = = =
                        

        致
礼!
 
                                 
        ZHAO Wenfeng
        [email protected]
          2009-01-22

Reply via email to