wso2esb - WSO2 ESB escaping xml entity to correct form -
i stuck on creating output message wso2 esb 5.0. correct form of message should be:
<request lang="11" user="user" pwd="pwd"> <query dateformat="%d-%m-%y" maxrecords="100"> <tables> <table tablename="company"/> </tables> <condition> <cond tablename="company" fieldname="upd" op=">" value="10.11.2016"/> <cond tablename="company" fieldname="updtime" op=">" value="01:00"/> </condition>
the fun part ">" in "op" attribute. there has ">" , not ">". cdata , character doesn`t work:
&
i tried payload factory, xslt transformation , script mediator different values no success. bad attempts:
<payloadfactory description="create request" media-type="xml"> <format> <request lang="11" user="user" pwd="pwd"> <query dateformat="%d-%m-%y" maxrecords="100"> <tables> <table tablename="company"/> </tables> <condition> <cond tablename="company" fieldname="upd" op=">" value="07.10.2016"/> <cond tablename="company" fieldname="updtime" op=">" value="01:00"/> </condition> </query> </request> </format> <args/> </payloadfactory>
with xslt:
<xslt description="create request" key="get-companies"/> <localentry key="get-companies" xmlns="http://ws.apache.org/ns/synapse"> <xsl:stylesheet exclude-result-prefixes="ws" version="1.0" xmlns:ws="http://ws.company.com/" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output encoding="utf-8" indent="yes" method="xml" omit-xml-declaration="no"/> <xsl:template match="/"> <xsl:element name="request"> <xsl:attribute name="lang">11</xsl:attribute> <xsl:attribute name="user">user</xsl:attribute> <xsl:attribute name="pwd">pwd</xsl:attribute> <xsl:element name="query"> <xsl:attribute name="maxrecords">100</xsl:attribute> <xsl:attribute name="dateformatin">%d-%m-%y</xsl:attribute> <tables xmlns=""> <table tablename="company"/> </tables> <condition xmlns=""> <xsl:element name="cond"> <xsl:attribute name="tablename">company</xsl:attribute> <xsl:attribute name="fieldname">upd</xsl:attribute> <xsl:attribute name="op">></xsl:attribute> <xsl:attribute name="value"> <xsl:value-of select="07.01.2016"/> </xsl:attribute> </xsl:element> <cond fieldname="updtime" op=">" tablename="company" value="01:00"/> </condition> </xsl:element> </xsl:element> </xsl:template> </xsl:stylesheet>
script mediator:
<script language="js"><![cdata[mc.setpayloadxml(<request lang="11" user="user" pwd="pwd"> <query dateformat="%d-%m-%y" maxrecords="100"> <tables> <table tablename="company"/> </tables> <condition> <cond tablename="company" fieldname="upd" op="&gt;" value="07.01.2016"/> <cond tablename="company" fieldname="updtime" op="&gt;" value="01:00"/> </condition> </query> </request>); ]]></script>
please me find correct form.
Comments
Post a Comment