USA: (978) 496-9990
Germany: +49 7031 221 471
UK: +44 207 193 1212

Tom Meets Fusion Debug – Week 2

First Debugging Session

We left off last week just after I had installed the FusionDebug plug-in to Eclipse. I was surprised at how quick it was to install FusionDebug.  Within just a few minutes I was ready to debug my CFML application on a ColdFusion 9 developer server.

At the start of this week, I was issued a new project to create a ColdFusion application that interacts with the Harvest time tracking software. Harvest provides an API that is well documented for PHP, Ruby, Pearl etc. but not for ColdFusion!  All that is provided is a simple URL based API that returns XML data once a request has been made.  I know I can use CFHTTP to send the request, but the structure of the XML returned is a mystery.

I began my investigation by using the built-in debugging feature <CFDUMP>. By passing the parsed XML to CFDUMP it presents you with the XML structure and the data within it, this is what I got.



I am a web developer; I like to see my XML looking like XML. I don’t want to see a formatted table, I want to see raw XML so I can easily use the data.

I thought about how I could get the raw XML. I didn’t want to write anymore CFML code.  As readers from last week will know, I am new to CFML and still learning, so I don’t feel confident creating code to print out this XML to the screen. It also seems like a waste of time as the application does not require the raw XML to be printed to the screen. So, I fire up FusionDebug.

I discovered this by accident, but I am glad I did! By pausing the application just after you make the CFHTTP query you can actually see all the elements that the request returns! You can see in the image below where I positioned my breakpoint.

As soon as the breakpoint is hit in the code, FusionDebug displays all the variables currently set. When you make a CFHTTP request this creates a variable called CFHHTP.  CFHHTP contains information about the request that has been made, including “Filecontent”. This is where the raw XML I was looking for is stored. Below you can see that by selecting “Filecontent” Eclipse displays the XML that was returned.

Now I know the exact structure of the XML without any ColdFusion formatting making things hard to read. FusionDebug has proven itself to me as a learning tool. I can use FusionDebug to work with API data I don’t understand. It helped me to learn how the XML data was structured and how I can use that to perform my required tasks. Over the last week I have used FusionDebug on several occasions.

Next week I will discuss some even more inventive ways of using FusionDebug to make life as a CFML developer easier.

Twitter: http://twitter.com/FusionDebug
Facebook: http://on.fb.me/cvYlCp
Youtube: http://www.youtube.com/fusiondebug

Comments are closed.