Refresh Coldfusion Web Service WSDL definition programmatically

Working on a project that requires two coldfusion servers to chat with each other through web services; something I haven't had to do for many years now. Anyway, as soon as I made a change to my publishing CFC, my consuming CFC started complaining. Seems that the server caches the WSDL signature of the remote cfc. That is great for production, but not so much for development. So, practically crawling into the wayback machine, I quickly found Brandon Purcell's nearly 6 year old solution to Refreshing Web Service Stubs in ColdFusion MX. With two moments worth of added abstraction:

<cffunction name="refreshRemoteService" access="public" output="false" returntype="boolean">
<cfargument name="service" type="string" required="true" />
<cfset _return = true />
<cfobject type="JAVA" action="Create" name="factory" class="coldfusion.server.ServiceFactory">     
<cfset RpcService = factory.XmlRpcService>    
<cfset RpcService.refreshWebService(arguments.service)>
<cfcatch type="any"><cfset _return = false></cfcatch>
<cfreturn _return />    

And here's a handy usage example:

remoteWebPublisher = "";
refreshStatus = refreshRemoteService(remoteWebPublisher);

ws = Createobject("
myResult = ws.myRemoteMethod();

Something worth remembering.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Doug Boude's Gravatar he he he. Works great unless your shared host disables access to the Coldfusion Service factory... "Permission denied for creating Java object: coldfusion.server.ServiceFactory.
Access to Java objects in the ColdFusion package has been disabled by the administrator. "
# Posted By Doug Boude | 7/3/09 3:08 PM
jason olmsted's Gravatar Yeah, you gotta have access to the underlying java. Without that, you can't even use cfdump - and that's when you look for a better coldfusion hosting provider.
# Posted By jason olmsted | 7/3/09 5:13 PM
Charlie Arehart's Gravatar Hey folks, I'll point out that there are other more formally supported ways to do this programmatically.

One is with an update in CF7 (which does require an Admin password as it uses the Admin API), as discussed here:

The other is with a change in CF8, which does NOT require any admin or Java access but instead is a new RefreshWSDL attribute you can use when invoking the web service (but which has its own issues to think about), which I discuss here:

Hope that's helpful. (I came across this while doing a search for something related to this and found the blog entry. Keep up the good work, Jason.)
# Posted By Charlie Arehart | 8/7/09 1:14 PM
jason olmsted's Gravatar @ Charlie, thanks for the links and the kind words. When I see the amazing amount of contribution that you, and others, give back to the development community I feel that I ought to try provide something useful; "try" being the operative word.
# Posted By jason olmsted | 8/10/09 11:47 PM
BlogCFC was created by Raymond Camden. This blog is running version Contact Blog Owner