Hi All,
I am trying to convert XML into x-www-form-urlencoded and send it as a Payload.
But not succesfull so far , Can anyone please help me out how can i convert my XML to x-www-form-urlencoded in Apigee Proxy ??
TIA
Solved! Go to Solution.
FYI : This Solution works for me.
Attached the XML for others reference .
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <AssignMessage async="false" continueOnError="false" enabled="true" name="am_setLogFireTargetParams" contentType="application/x-www-form-urlencoded"> <DisplayName>am_setLogFireTargetParams</DisplayName> <Set> <Headers> <Header name="Authorization">Basic cvbcfb==</Header> </Headers> <Verb>POST</Verb> <FormParams> <FormParam name="xml_data">{logfire_xml}</FormParam> </FormParams> </Set> <AssignVariable> <Name>target.copy.pathsuffix</Name> <Value>false</Value> </AssignVariable> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> <AssignTo createNew="false" transport="http" type="request" content-type="application/x-www-form-urlencoded"/> </AssignMessage>
Use the Extract Variables policy and extract (via XPath) the XML elements to variables. Then use Assign Message policy to add FormParam fields with those variables.
Hi @Srinandan Sridhar ,
Thanks for the reply.
Do you have any sample, how to use FormParam in Assign message Policy ?
That would be more precise for me.
Please check below, How would i send "xml_encoded" as a payload after ?
<FormParams> <FormParam name="xml_encoded">{xml_data}</FormParam>
</FormParams>
FYI : This Solution works for me.
Attached the XML for others reference .
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <AssignMessage async="false" continueOnError="false" enabled="true" name="am_setLogFireTargetParams" contentType="application/x-www-form-urlencoded"> <DisplayName>am_setLogFireTargetParams</DisplayName> <Set> <Headers> <Header name="Authorization">Basic cvbcfb==</Header> </Headers> <Verb>POST</Verb> <FormParams> <FormParam name="xml_data">{logfire_xml}</FormParam> </FormParams> </Set> <AssignVariable> <Name>target.copy.pathsuffix</Name> <Value>false</Value> </AssignVariable> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> <AssignTo createNew="false" transport="http" type="request" content-type="application/x-www-form-urlencoded"/> </AssignMessage>
Thank you @gautam1 for sharing solution with community, I am sure it will be helpful for others.