This is a simple example showing how to call another flow and include that result in the resultant xml file. The opertaion "lookup" should be used in dataweave.
<?xml version="1.0" encoding="UTF-8"?> <mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd"> <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/> <flow name="dataweaveexampleFlow"> <!-- <http:listener config-ref="HTTP_Listener_Configuration" path="/ab" doc:name="HTTP"/> --> <poll doc:name="Poll"> <fixed-frequency-scheduler frequency="1000" /> <expression-component doc:name="Expression"> <![CDATA[ dataweaveexample.User u1 = new dataweaveexample.User(); u1.setName("DataWeave"); u1.setEmail("contact@javaroots.com"); u1.setRate(148.3385); dataweaveexample.User u2 = new dataweaveexample.User(); u2.setName("Example"); u2.setEmail("contact@javaroots.com"); u2.setRate(28.3385); List list = new java.util.ArrayList(); list.add(u1); list.add(u2); payload = list; ]]> </expression-component> </poll> <logger level="INFO" message="payload is :#[payload]" doc:name="Logger"/> <dw:transform-message doc:name="Transform Message"> <dw:input-payload mimeType="application/java"/> <dw:set-payload><![CDATA[%dw 1.0 %output application/xml --- { users:{(payload map { user:{ name:$.name, email:$.email, count:$$+1, rate: $.rate as :string {format :"###,00"}, flowValue:lookup("callFromAnotherFlow",$) } }) } }]]></dw:set-payload> </dw:transform-message> <logger level="INFO" message="payload lodis is :#[payload]" doc:name="Logger"/> </flow> <flow name="callFromAnotherFlow"> <set-payload value="Javaroots.com Mule ESB DataWeave Example" doc:name="Set Payload"/> </flow> </mule>Post Comments and Suggestions !!!