|
CfHttp compression responses when calling a url - 360 Voice part 1 |
I was recently writing a service to consume an xml feed, and I stumbled upon an issue that I had previously not seen with the cfhttp tag. These days I would usually opt for a cfc call to a webservice, and consume it as a 'true' service object, but this is an old school http request, as I am reading asp page content. I setup the standard cfhttp code in coldfusion.
Unfortunately the http response was "Connection Failure". After investigating various potential authentication issues from both the destination server and the source server I had hit a wall. I fired up 'HTTP debugger' and had a scan of the http responses to see if anything stood out, and discovered that the http response was actually '200' which signifies everything is ok. So I was actually receiving a valid response. Maybe the problem was coldfusion. It transpires that if CF receives compressed or encrypted http responses you have to tell it what to do with them manually.
2<cfhttpparam type="Header" name="TE" value="deflate;q=0">
By adding these headers to the cfhttp you are requesting that the server return uncompressed responses, allowing coldfusion to handle the data returned. I ended out piecing this together from several different sources, but this site (http://www.talkingtree.com/blog/index.cfm/2004/7/28/20040729) has a very good blog entry on this as well. So thanks Steven Erat, you helped a ton there!
Complete code:
2<cfhttpparam type="Header" name="Accept-Encoding" value="deflate;q=0">
3<cfhttpparam type="Header" name="TE" value="deflate;q=0">
4</cfhttp>
Now on to why I was actually writing this cfhttp request in the first place, http://www.360voice.com/, where you can hook up your XBox 360 to a web data feed.
There are no comments for this entry.
[Add Comment] [Subscribe to Comments]