When you use WebServices with ColdFusion, the WSDL ‘stub’ is cached in CF Administrator (presumably for performance reasons).
This can be a pain when you need to change the WSDL and you don’t have access to CF Admin to flush the service which is the scenario I found myself in today.
Luckily for me I sit near some ColdFusion peeps who sorted me out with a little Java method (courtesy of the ServiceFactory) to flush a WSDL from a ColdFusion template.
Basically all you need to do is:
<cfset wsdl = "yourwsdlpath.wsdl">
<cfobject type="java" action="Create" name="factory" class="coldfusion.server.ServiceFactory">
<cfset RpcService = factory.XmlRpcService>
<cfset RpcService.refreshWebService(wsdl)>
I also wrapped it up in a little function:
<cffunction name="flushWebService" access="public" output="false" returnType="void" hint="Flush a cached WebService in ColdFusion Administrator">
<cfargument name="wsdlURL" type="string" required="false" default="#getWSDLURL()#" hint="URL of the WSDL to flush" />
<cfscript>
var oFactory = createObject("java", "coldfusion.server.ServiceFactory");
oFactory.XmlRpcService.refreshWebService(arguments.wsdlURL);
return;
</cfscript>
</cffunction>
Thanks Marko (and Mark)
After the fact I did some googling and found a great read from Doug Boude on Refreshing Cached ColdFusion Webservices Through the Back Door in case you’re interested.