Hi, How to filter an empty response element in WSO2 ESB payload factory.
*Proxy Service* <?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="count_iterate" transports="http,https" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence> <property name="it_count" value="0" scope="operation"/> <iterate expression="//symbols/symbol" sequential="true"> <target> <sequence> <property name="synapse_it_count" expression="get-property('operation', 'it_count')"/> <script language="js">var cnt_str = mc.getProperty('synapse_it_count'); var cnt = parseInt(cnt_str); cnt++; mc.setProperty('synapse_it_count', cnt.toString());</script> <property name="it_count" expression="get-property('synapse_it_count')" scope="operation"/> <aggregate> <completeCondition> <messageCount min="-1" max="-1"/> </completeCondition> <onComplete expression="//symbol"> <log level="custom"> <property name="number of symbols" expression="get-property('operation','it_count')"/> </log> <payloadFactory media-type="xml"> <format> <m xmlns=""> <n>$1</n> </m> </format> <args> <arg evaluator="xml" expression="//symbol"/> </args> </payloadFactory> <respond/> </onComplete> </aggregate> </sequence> </target> </iterate> </inSequence> </target> <description/> </proxy> *Scenario 1* *Sample Request* <symbols> <symbol>WSO2</symbol> </symbols> *Sample Response* <m> <n>WSO2</n> </m> *Scenario 2* *Sample Request* <symbols> <symbol></symbol> </symbols> *Sample Response given from ESB* <m> <n> <symbol/> </n> </m> Is there any way to avoid scenario 2? Or is there any workaround? I just need the following response . *Sample Response expected* <m> <n></n> </m> Regards Charmi
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
