CFC 101: Presentation to CFUG Auckland

I made a presentation on CFCs to CFUG Auckland a few weeks back. Most of the CFUG users already had some experience with CFCs.

The presentation was fairly short. But the discussion was lively. A need was expressed to understand CFC best practices as applied to particular problems. There was also an element of sounding off experiences. And that made it quite interesting.

I’ve attached a copy of the presentation and the sample code used.

Fixing error: The XML-RPC service is not available

Late Friday evening, I was developing a small application on my laptop that looped over a list of webservice URLs and fired off a given function on each of the webservices to retrieve some information. The application worked beautifully and life was good!

But on Monday morning, I restarted the CFMX 7 Server, and found that I couldn’t log into to CF Administrator. I was getting the following error:

The XML-RPC service is not available.
This exception is usually caused by service startup failure. Please check your server configuration.

The error occurred in Application.cfm: line 82
-1 : Unable to display error’s location in a CFML template.

This is definitely not an error that you want to be staring at first thing on Monday morning. Here is how I fixed it.Mr Google brought up another blog that mentioned the same error. Apparantly a missing neo-xmlrpc.xml on a CFMX 7 server can cause this.

So, I opened \WEB-INF\cfusion\lib\ directory where the file should exist. And it was there. So it wasn’t missing in my case. But date modified value pointed that it had been changed on Friday.

Opened the file an XML editor. Noticed that it contained a WDDX packet containing links to the webservices I was accessing using my application. Interesting. So next, I tried to validate whether the XML doc was well formed or not. And it turned out that it wasn’t. CF Server had added characters into the XML that it didn’t like.

It contained nodes like:

<var name=’<;char code=’0d’/>/folder/webservice.cfc?wsdl’>

Notice that there is an extraneous:

<char code=’0d’/>

This is what was breaking the xml. Interestingly, the character code ‘0d’ is equivalent to carriage return.

Once I removed all such references and the XML validated as well-formed, life was back to normal!

It would be interesting to figure out why the CFMX server inserted these characters in the first place. However, that is a mission for another day.

On with Monday now…