// TODO This should be type instead of messageType
this.process.addMessageVariable(arrayName, WSConstants.XSD_NS, WSConstants.XSD_ANY_TYPE.getLocalPart());
// Extract array from the previous node.
GpelAssignCopyFrom arrayFrom = createAssignCopyFrom(splitNode.getInputPort(0));
GpelAssignCopyTo arrayTo = new GpelAssignCopyTo(this.bpelNS);
arrayTo.setVariable(arrayName);
GpelAssignCopy arrayCopy = new GpelAssignCopy(this.bpelNS, arrayFrom, arrayTo);
GpelAssign arrayAssign = new GpelAssign(this.bpelNS, arrayCopy);
sequence.addActivity(arrayAssign);
// Extract a item from array
String valueName = splitNode.getID() + FOREACH_VALUE_SUFFIX;
// TODO set local variable in scope instead of process
// TODO This should be type instead of messageType
this.process.addMessageVariable(valueName, WSConstants.XSD_NS, WSConstants.XSD_ANY_TYPE.getLocalPart());
GpelAssignCopyFrom valueFrom = new GpelAssignCopyFrom(this.bpelNS);
valueFrom.setVariable(arrayName);
valueFrom.setQuery("$" + arrayName + "/*[$i]");
GpelAssignCopyTo valueTo = new GpelAssignCopyTo(this.bpelNS);
valueTo.setVariable(valueName);
GpelAssignCopy valueCopy = new GpelAssignCopy(this.bpelNS, valueFrom, valueTo);
GpelAssign valueAssign = new GpelAssign(this.bpelNS, valueCopy);
subSequence.addActivity(valueAssign);
addBlock(forEachBlock, subSequence);
Node mergeNode = getMergeNode(splitNode);
String outputName = mergeNode.getID() + ARRAY_SUFIX;
// TODO This should be type instead of messageType
this.process.addMessageVariable(outputName, WSConstants.XSD_NS, WSConstants.XSD_ANY_TYPE.getLocalPart());
GpelAssignCopyFrom outputFrom = createAssignCopyFrom(mergeNode.getInputPort(0).getFromPort());
GpelAssignCopyTo outputTo = new GpelAssignCopyTo(this.bpelNS);
outputTo.setVariable(outputName);
outputTo.setQuery("/value[$i]");
GpelAssignCopy outputCopy = new GpelAssignCopy(this.bpelNS, outputFrom, outputTo);
GpelAssign outputAssign = new GpelAssign(this.bpelNS, outputCopy);
subSequence.addActivity(outputAssign);
GpelForEach forEach = new GpelForEach(this.bpelNS, "i", "1", "count($" + arrayName + "/*)",