Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.
I am the chief technical officer at InVision App, Inc - a prototyping and collaboration platform for designers, built by designers. I also rock out in JavaScript and ColdFusion 24x7.
Meanwhile on Twitter
Loading latest tweet...
Ben Nadel at Scotch On The Rock (SOTR) 2010 (London) with:

Campaign Monitor API Connection Failure With CFHTTP And GZIP Compression

By Ben Nadel on
Tags: ColdFusion

To manage mailing lists for clients and personal projects, I generally use Campaign Monitor. Its SOAP-based API has many different methods for subscribing, resubscribing, and unsubscribing email users to various client lists. The API interaction was great for a long time and then suddenly, a few weeks ago, I started getting "Connection Failure" on all of my ColdFusion CFHTTP requests.

SOAP-Based CFHTTP Connection Failure. 

I have no idea what the heck was going on. I could connect to the WSDL file just fine using the browser so I couldn't figure out why it was suddenly failing with ColdFusion's CFHTTP request. After a bit of Googling, I came across a post by Dan G. Switzer, II that discussed this very topic: CFHTTP "Connection Failures" issues with Gzip. In the post, Dan discussed that the problem comes from the fact that a connection failure in CFHTTP might be caused by the use of GZIP compression on the target server (which CFHTTP cannot handle).

I checked the compression in FireBug to confirm that this was, in fact, the case:

GZIP Compression On SOAP Web Service Request. 

To fix this incompatibility, Dan gave a few different options. The one I ended up going with was passing in a no-compression CFHttpParam header value with my CFHTTP request:

  • <!--- Post SOAP data to campaign monitor. --->
  • <cfhttp
  • url="......"
  • method="get"
  • result="objSOAPPost">
  • <cfhttpparam
  • type="header"
  • name="accept-encoding"
  • value="no-compression"
  • />
  • <!--- More params go here. --->
  • </cfhttp>

Adding that CFHttpParam did the trick! Thanks Dan!

Reader Comments

You're welcome! :)

I actually just ran across another issue that I'm getting ready to blog about. This one wasn't about GZIP, but redirect rules.

Reply to this Comment


Seems odd that they would all of a sudden change this. Although, I guess its not a problem for most people? Maybe they sent out an "update" email that I just never saw.

Reply to this Comment

Hi Ben - On the CM forum, in a post about their ColdFusion API wrapper they recommend contacting you, but why don't they promote it? I am new to CM, so still learning my way around. Is there specific info on the API available?

Thanks for your help!


Reply to this Comment

Thanks for the offer Ben. Just trying to see if they plan on (re-)releasing an API wrapper for CF. In the meantime I was able to get what I needed done - adding a checkbox to an existing form to sign up for the newsletter - without any additional code.


Reply to this Comment

Just wondering if, in the meanwhile, there is some kind of basic coldfusion wrapper for the Campaign Monitor API. Cant find anything on their site.
Ben or Mike? Any pointers?


Reply to this Comment


I did a Google search for "Campaing Monitor cfc" and there appears to be some things you might follow up with. I have not used a wrapper personally; I've only used the "subscribe" method, so no real need for a whole CFC.

Reply to this Comment


If you can't find anything good, I could probably put together the basis of something.

Reply to this Comment


I just approached Jon with the question how far along his CM wrapper is. If i get anything i will keep you posted.



Reply to this Comment

The server I tried to access does not have gzip available. When I checked in the header response, it said:

Content-Encoding: deflate

(They are different aren't they?)

But that doesn't matter, what matters is your trick solved my problem too! :-)

Thanks Ben & Dan,

Reply to this Comment


Heck yeah! I don't fully understand the various encoding types, but I am glad this worked for you.

Reply to this Comment

Post A Comment

You — Get Out Of My Dreams, Get Into My Comments
Live in the Now
Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.