handle arrays in bpel
sw_bpel Nov 3, 2008 9:55 AMhello,
i have some problems with handling arrays in my bpel-process. i have to invoke 3 web services and the response of the first one contains an array of user roles. so first i declare a variable for the iteration and also a variable for the number of elements in the array. then i create a while loop to check if the array contains a specific role. in that case i call the second web service. so far that's working fine, but the second web service returns also an array. but now i want to return this response as a part of the bpel process response. and here is my problem. How do i do that? i either get only the first element of the array as response of the bpel process or i get the following error:
15:42:48,209 ERROR [XPathEvaluator] cannot create element for step with non-numeric predicate: [(DefaultNameStep): bpelReturnSW]
how to do that array handling?
a fragment of my bpel-file:
<bpws:sequence name="Sequence1"> <bpws:assign name="assignSukoInput" validate="no"> <bpws:copy> <bpws:from><![CDATA['']]></bpws:from> <bpws:to><![CDATA[$sukoRequest.getAllUnits]]></bpws:to> </bpws:copy> </bpws:assign> <bpws:invoke inputVariable="sukoRequest" name="invokeSukoService" operation="getAllUnits" outputVariable="sukoResponse" partnerLink="suko" portType="ns1:Fidefri4amo" /> <bpws:assign name="assignSukoCounter" validate="no"> <bpws:copy> <bpws:from><![CDATA[1]]></bpws:from> <bpws:to variable="sukoIterator" /> </bpws:copy> <bpws:copy> <bpws:from><![CDATA[count($sukoResponse.getAllUnitsResponse/return)]]></bpws:from> <bpws:to variable="sukoCounter" /> </bpws:copy> </bpws:assign> <bpws:while name="While"> <bpws:condition><![CDATA[$sukoCounter >= $sukoIterator]]></bpws:condition> <bpws:sequence name="Sequence2"> <bpws:assign name="assignSukoOutput" validate="no"> <bpws:copy> <bpws:from><![CDATA[$sukoResponse.getAllUnitsResponse/return[$sukoIterator]/id]]></bpws:from> <bpws:to><![CDATA[$output.bpelResponse/bpelReturnSuko[$sukoIterator]/bpelResponseSukoUnitID]]></bpws:to> </bpws:copy> <bpws:copy> <bpws:from><![CDATA[$sukoResponse.getAllUnitsResponse/return[$sukoIterator]/name]]></bpws:from> <bpws:to><![CDATA[$output.bpelResponse/bpelReturnSuko[$sukoIterator]/bpelResponseSukoUnitName]]></bpws:to> </bpws:copy> </bpws:assign> <bpws:assign name="stepSukoIterator" validate="no"> <bpws:copy> <bpws:from><![CDATA[$sukoIterator + 1]]></bpws:from> <bpws:to variable="sukoIterator" /> </bpws:copy> </bpws:assign> </bpws:sequence> </bpws:while> </bpws:sequence>
thank you for your help!!!!
greetings stefan