wso2bpelwso2-business-process

How to insert/append new node entries to an element list in WSO2 BPEL?


Using wso2bps-3.5.1

I have searched but not found any information on how to dynamicaly populate a list of elements in WSO2 BPS BPEL.

My use case is to loop through a list given from an Invoke activity to produce another list of elements. I'm using a Foreach activity to loop where I create a local scoped variable inside the loop to build the new list entry. But, I have no idea how to insert this node into the new list. Are there any built in functions?

Any examples would be appreciated.


Solution

  • I was able to solve this question my self:

        xmlns:test="http://ode/bpel/unit-test.wsdl"
        queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
        expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
    ...
    <bpel:assign validate="no" name="Assign">
            <bpel:copy>
                <bpel:from>
                    <![CDATA[ode:insert-after($closeAccountResponse.closeAccountResponsePart/xclac:accountConnections, $closeAccountResponse.closeAccountResponsePart/xclac:accountConnections/xcom:accountConnection, $record)]]>
                </bpel:from>
                <bpel:to part="closeAccountResponsePart" variable="closeAccountResponse">
                    <bpel:query><![CDATA[xclac:accountConnections]]></bpel:query>
                </bpel:to>
            </bpel:copy>
        </bpel:assign>