<sequence name="my-in-seq"> <!-- for each object under data element --> <foreach expression="//data"> <sequence> <!-- set the "name" attribute of the object as property "temp" --> <property expression="//data/name" name="temp"/> <!-- Convert "name" value which can be retrieved from "temp" property to uppercase and save it in "upperCaseName" property --> <script language="js"><![CDATA[var name = mc.getProperty("temp"); mc.setProperty("upperCaseName",name.toUpperCase());]]></script> <!-- create the corresponding resulting object --> <payloadFactory media-type="xml"> <format> <!-- let the root of the resulting payload be "info" --> <info> <!-- set 1st arg value as "id" element --> <id>$1</id> <!-- set 2nd arg value as "classid" element --> <classid>$2</classid> <!-- set 3rd arg value as "name" element --> <name>$3</name> <!-- For the following two elements we are hardcoding values --> <university>University of Moratuwa</university> <department>CSE</department> </info> </format> <args> <!-- The value evaluated from this will be set in place of $1 inside format fn:concat('ID',get-property('uppercaseName'),//data/id) will concatenate the string "ID", the value of the property "upperCaseName" and the "id" attribute of the object --> <arg evaluator="xml" expression="fn:concat('ID',get-property('upperCaseName'),//data/id)"/> <!-- The value evaluated from this will be set in place of $2 inside format Like this we can use json evaluator too. The xml evaluator equivalent for this would be <arg evaluator="xml" expression="//data/id"/>--> <arg evaluator="json" expression="$.data.id"/> <!-- The value evaluated from this will be set in place of $3 inside format --> <arg evaluator="xml" expression="get-property('upperCaseName')"/> </args> </payloadFactory> </sequence> </foreach> <!-- we want the resulting payload to be in JSON format --> <property name="messageType" scope="axis2" value="application/json"/> <send> <!-- send the resulting payload to this endpoint --> <endpoint> <http method="POST" trace="disable" uri-template="http://localhost:8080/test"/> </endpoint> </send> </sequence>