I am trying to send a request through wso2 ESB 5.0.0 to external HTTP API which require application/x-www-form-urlencoded
format. I found this post:
Sending Content-Type application/x-www-form-urlencoded WSO2 ESB
and it's almost works, but this vendor also require parameters in array format like this:
to[email@email.com][message_id]=message_id
Unfortunately xml nor json doesn't allow me to build parameters with square brackets in xml node names or in json key names. Escaping through %5B
%5D
also won`t help.
I also tried ExpandingMessageFormatter but with no success - I can`t build well-formed property and replace message of a body with it's content. For example:
<property name="messageBody" scope="default" type="STRING" value="to%5Bemail%40email.com%5D%5Bmessage_id%5D=id&to%5Bemail%40email.com%5D%5Breciver_name%5D=Name%20Surname&smtp_account=2.xxx.smtp&subject=Test%20temat&html=%3Chtml%3E%3Cb%3ETEST%3C%2Fb%3E%3C%2Fhtml%3E&from=email%40email.com&from_name=xxx"/>
<payloadFactory media-type="json">
<format>"$ctx:messageBody"</format>
<args/>
</payloadFactory>
or with EnrichMediator:
<enrich>
<source clone="true" property="messageBody" type="property"/>
<target type="body"/>
</enrich>
Please, any advise will be helpful.