xml urlencoded and body data problem
Hi there,
I have an xml body which needs to be sent to an API, I have done many of this and I'm connecting correctly to the API but for some reason I can't get this one to work. I'm receiving: "invalid Request Message. No valid XML. XML must be url-encoded! maybe it contains a not encoded ampersand or something similar"
Mentions these reuirements:
1. message sent must be UTF-8 encoded
2. Unparsed XML Data, starts with “<![CDATA[“ and ends with “]]>
3. The content-type of your message must be set to:application/x-www-form-urlencoded;charset=UTF-8
Doesn't mention any headers so I'm really unsure what headers to send or not to send and it's asking for the body to be urlencoded so i'm wrapping it in URLEncodedFormat() function, have tried with or without it.
The body is not getting through for some reason, done it with <cfhttpparam type="body" and <cfhttpparam type="xml", none works....
So part of the xml the data is:
<cfsilent>
<cfsavecontent variable="xmlInfo">
<cfoutput>
<?xml version="1.0" encoding="UTF-8"?>
<Request version="1.0" responseURL="#responseURL#">
<Transaction mode="#TransactionMode#" requestTimestamp="#DateFormat(NOW(),"yyyy-mm-dd hh:mm:ss")#">
<Identification>
<OrderID>12345678</OrderID>
<UUID>x65m432n210o987-20101004-1346</UUID>
</Identification>
</cfoutput>
</cfsavecontent>
</cfsilent>
THen I have:
<cfhttp url="#urlAddress#" method="post" username="#httpUserName#" password="#httpPassword#" throwonerror="yes" port="443" result="TheResult" charset="utf-8" useragent="cgi.HTTP_USER_AGENT">
<cfhttpparam type="header" name="Content-type" value="application/x-www-form-urlencoded;charset=UTF-8">
<cfhttpparam type="header" name="Content-length" value="#Len(Trim(transInfo))#">
<cfhttpparam type="header" name="charset" value="utf-8">
<cfhttpparam type="Header" name="TE" value="deflate;q=0">
<cfhttpparam type="header" name="Accept-Encoding" value="*" />
<cfhttpparam type="Header" name="TE" value="deflate;q=0">
<cfhttpparam type="Header" name="Accept-Encoding" value="deflate;q=0">
<cfhttpparam type="header" name="accept-encoding" value="no-compression" />
<cfhttpparam type="header" name="Document-type" value="Request">
<cfhttpparam type="body" value="#URLEncodedFormat(xmlInfo,"utf-8")#">
</cfhttp>
Any suggestions would be greatly appreciated.
CHeers
