Hi Waruna,

I tried round($Counter) with no luck. When it's used with the round, it
logs a selection error even for a single element in the array which was not
the case in above code. It works for a single element.

Isn't it the problem is not initializing the result array with the number
of elements in the input array?

Thanks,
 - Chethiya


On Tue, Feb 28, 2012 at 12:22 PM, Waruna Ranasinghe <war...@wso2.com> wrote:

> On Tue, Feb 28, 2012 at 12:01 PM, Chethiya Abeysinghe <cheth...@wso2.com>
> wrote:
> > Hi,
> >
> > I'm trying to assign an array to another array in a BPEL process.
> Following
> > is the bpel code for that:
> >
> >  <bpel:forEach parallel="no" counterName="Counter" name="ForEach">
> >
> <bpel:startCounterValue><![CDATA[1]]></bpel:startCounterValue>
> >
> <bpel:finalCounterValue><![CDATA[count($input.payload/tns:arr)
> > ]]></bpel:finalCounterValue>
> >             <bpel:completionCondition></bpel:completionCondition>
> >             <bpel:scope>
> >                 <bpel:assign validate="no" name="Assign">
> >
> >                     <bpel:copy>
> >                         <bpel:from>
> >                             <bpel:literal
> > xml:space="preserve"><tns:ArrayBPELProcessResponse
> > xmlns:tns="http://www.arraybpel.process";
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
> > <tns:result></tns:result>
> > </tns:ArrayBPELProcessResponse></bpel:literal>
> >                         </bpel:from>
> >                         <bpel:to variable="output"
> part="payload"></bpel:to>
> >                     </bpel:copy>
> >                     <bpel:copy>
> >                         <bpel:from part="payload" variable="input">
> >                             <bpel:query
> >
> queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:arr[$Counter]]]></bpel:query>
> IIRC there is an issue when evaluating the $Counter variable. Can you
> try using tns:arr[round($Counter)]
>
> Thanks,
> Waruna
> >                         </bpel:from>
> >                         <bpel:to part="payload" variable="output">
> >                             <bpel:query
> >
> queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:result[$Counter]]]></bpel:query>
> >                         </bpel:to>
> >                     </bpel:copy>
> >                 </bpel:assign>
> >             </bpel:scope>
> >         </bpel:forEach>
> >
> >
> > When I try to send multiple elements in the array it gives an error
> though
> > it works for an array with a single element.
> >
> > SOAP message is:
> >
> > <body>
> >    <p:ArrayBPELProcessRequest xmlns:p="http://www.arraybpel.process";>
> >       <!--0 or more occurrences-->
> >       <arr xmlns="http://www.arraybpel.process";>value1</arr>
> >       <arr xmlns="http://www.arraybpel.process";>value2</arr>
> >    </p:ArrayBPELProcessRequest>
> > </body>
> >
> > And the error log is:
> >
> > [2012-02-28 11:45:12,148]  INFO - ASSIGN - Assignment Fault:
> > {http://docs.oasis-
> >
> open.org/wsbpel/2.0/process/executable}selectionFailure,lineNo=73,faultExplanati
> > on={
> http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure:
> > M
> > ultiple results for expression: 'tns:arr[$Counter]' against '<?xml
> > version="1.0"
> >  encoding="UTF-8"?>
> > <ArrayBPELProcessRequest xmlns="http://www.arraybpel.process";
> > xmlns:p="http://ww
> > w.arraybpel.process" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/";
> > xmlns:w
> > sa="http://www.w3.org/2005/08/addressing";><arr
> > xmlns="http://www.arraybpel.proce
> > ss">value1</arr><arr
> > xmlns="http://www.arraybpel.process";>value2</arr></ArrayBPE
> > LProcessRequest>'
> > [2012-02-28 11:45:12,168]  WARN - BpelProcess - Instance 270 of
> > {http://www.arra
> > ybpel.process}ArrayBPELProcess-9 has completed with fault: FaultData:
> > [faultName
> > ={
> http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure,
> > fau
> > lType=null
> > ({http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionF
> > ailure: Multiple results for expression: 'tns:arr[$Counter]' against
> '<?xml
> > vers
> > ion="1.0" encoding="UTF-8"?>
> > <ArrayBPELProcessRequest xmlns="http://www.arraybpel.process";
> > xmlns:p="http://ww
> > w.arraybpel.process" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/";
> > xmlns:w
> > sa="http://www.w3.org/2005/08/addressing";><arr
> > xmlns="http://www.arraybpel.proce
> > ss">value1</arr><arr
> > xmlns="http://www.arraybpel.process";>value2</arr></ArrayBPE
> > LProcessRequest>')] @73
> >
> >
> > Could someone please comment what's going wrong in this?
> >
> > Thanks,
> >  - Chethiya
> >
> > _______________________________________________
> > Carbon-dev mailing list
> > Carbon-dev@wso2.org
> > http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
> >
>
>
>
> --
> -------------------------------------------------------------------------
> Waruna Ranasinghe
> Senior Software Engineer, WSO2
>
> Mobile: +94 724 318285
> BLOG: http://warunapw.blogspot.com
>
> www.wso2.com - "Lean . Enterprise . Middleware"
> _______________________________________________
> Carbon-dev mailing list
> Carbon-dev@wso2.org
> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>



-- 
Chethiya Abeysinghe
Software Engineer; WSO2, Inc.;  http://wso2.com/
email: cheth...@wso2.com     phone: +94 777334874
blog: chethiya3000.blogspot.com
_______________________________________________
Carbon-dev mailing list
Carbon-dev@wso2.org
http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev

Reply via email to