<!--Required:Define first connector in the flow-->
<arc:set attr="flow.connectorid" value="Script_ChangeName"/>
<!--Define workspace where flow is located, if not set this uses the Default workspace-->
<arc:set attr="flow.workspaceid" value="Default"/>
<!--Set filename of file to pass through flow as messagename attribute-->
<arc:set attr="flow.messagename" value="[Filename]"/>
<!--Get contents of message to pass to flow and set as messagedata attribute-->
<!--Note this loads the contents of the file as a string-->
<arc:set attr="in.file" value="[Filepath]" />
<arc:call op="fileRead" in="in" out="out" >
<arc:set attr="flow.messagedata" value="[out.file:data]" />
</arc:call>
<!--Set a header and its value preserving the original filename, to reference later-->
<arc:set attr="flow.headername#1" value="origfilename"/>
<arc:set attr="flow.headervalue#1" value="[Filename]"/>
<!--You must call this operation through connector.rsc and pass in a valid authtoken -->
<arc:call op="connector.rsc/flowExecute" authtoken="test:0d1V7j2r2Z7a9z1Y6z8y" in="flow" out="status">
<!-- This if statement checks if the message encountered an error during processing. If yes, the message is finalized as Error in this script.-->
<arc:if exp="[status.result | equals('Error')]" >
<arc:throw code="FlowFailed" desc="The message failed to be processed by the flowExecute call due to the following error: [status.ErrorMessage | def]" />
</arc:if>
</arc:call>