Last month I blogged about an odd issue with Axis2 web services. Basically, the CFC was persisting past the initial hit. Normally CFCs are recreated on every request. This didn't seem to be the case with Axis2 web services.

I filed a bug report for the issue and today I got a response from an engineer:

This is a change in behavior in how we designed the Axis 2 web services support.

In Axis 1, For every web service request we created a new CFC instance and the request was handled by this new instance. That is why the variables always gets re initialized for every request.

In Axis 2, we are creating the CFC instance the first time only. For every subsequent requests the same instance is used. So you are seeing the caching there. A new CFC instance will be created only if service CFC is modified.

Normally if you are deploying an axis2 based aar, in tomcat, you will see the same behavior.

This was a design decision we took. Are you facing any issues because of this caching? Do you have a requirement to use different CFC instances for each web service request?

So, long story short, this is expected. I want to be clear so people understand the issue. This is not like trusted cache, where changing the code doesn't reflect on the server. This is not like the case where you change a method and have to tell CF to refresh the WSDL. No, this is data persistence, as my example demonstrates. In every other case of using a CFC - either via Ajax or WSDL - this is not how CFCs act.

So... um... yeah. I guess watch out for it. Or take the advice I gave on the last blog entry and avoid WSDL like the plague on humanity it is. If you feel like this was a bad design by the ColdFusion engineers, please post your thoughts on the bug entry, not here. (Or both - just keep in mind I've got no power to change things there. ;)