Integrating ColdFusion with FogBugz results in cfhttp conx failure
The development team at Webapper has been using FogBugz for a couple years now and we like it well enough not to bother switching to anything else. One thing I found lacking is a “customer portal” – a way for our clients to review the status of open tickets we’re tracking for their projects. Our old system, OnTime, had this feature and it seems pretty basic. FogBugz does have a weak “anonymous user” feature but it doesn’t work how we need it to work. So we built a custom ColdFusion front-end using the FogBugz API. It has its own user table and user-project table, and the rest is just calls to FogBugz for tickets in a project, details about a ticket, etc.
But I encountered an issue right away, using cfhttp to call the FogBugz API. Here is the code I tried:
<cfhttp method="get" url="https://webapper.fogbugz.com/api.asp"></cfhttp>
<cfdump var="#cfhttp.FileContent#">
I kept getting “Connection Failure”. If you’re familiar with the FogBugz API (or if not but you have a good imagination and can take a guess what that URL might do) you might notice I’m not even doing an “action”. You can even try that URL in a browser and see that it displays a message about not being logged in, which is a response from the API. I wasn’t even getting that far. It’s like there was some invisible wall in between my cfhttp call and the API.
Because calls to the FogBugz API need to run over SSL, I thought I had to add the cert to the cacerts store in my JRE to make the SSL bit work. That took a while to do since I’m on a mac and the cacerts never looked right. Eventually though I got a cert added, but the cfhttp call still wouldn’t work. I never did figure out what the root cause was, but I did work around it.
I wrote some java code to do the job:
objUrl = createobject("java","java.net.URL").init("#local.baseURL#&#local.queryString#");
conn = objUrl.openConnection();
...followed by some InputStreamReader and BufferedReader to get the output.
And now it works. So I know my cacerts thing is right and it’s a deficiency in cfhttp itself. What, I can’t be sure, but I don’t care. So if you’re struggling with ColdFusion and FogBugz integration using cfhttp, try this instead. And if you have gotten cfhttp to work with the FogBugz API, please share your code!







