Refreshing Coldfusion Web Service WDSL

Using web service is one of the good solution when you try to consume 3th party or integrate your system with other system without knowing how their internal logic.

When you try to call the web service for the first time, CF actually will chace the web service by using the web service description (WSDL) that response from the target server to create a java proxy/stub based on that, than it will be reused for the following call from CF to the same web service again.

CF doing that is actually try to improve the performance for the web service calling, but it come with some disadvantage when the target web service being changed by adding a new require parameter or return an extra parameter, your script will trigger an error message, this is because your CF have no knowledge about the new changing make on the target site. It will continue to use the older cached proxy/stub.

To resolved this problem, you may need to manually refresh the cache that created by the CF in the early call to inform CF to refresh it’s cache of that proxy stub.

There are more than 1 way that you can doing that, the following are the sample 4 difference way to achieve the same result:

I. ColdFusion Administrator



II. Programatically:

In ColdFusion 8, you have two options:

i. Cfinvoke’s refreshWSDL attribute:

<cfinvoke webservice="#wsdl#" method="method" returnvariable="rv"<br />refreshWSDL="yes"><br />	<cfinvokeargument name="arg" value="1"/><br /></cfinvoke>


ii. Cfobject’s arguments structure

<br /><cfscript><br />    wsargs = structnew();<br />    wsargs.refreshwsdl="yes";<br />    somevar = createobject("webservice","http://[server]/webserviceurl]",wsargs);<br />    ...<br /></cfscript><br />

In ColdFusion 7, however, you can use the following solution:

<cfset wsAddress = "http://your.web/service/url.cfc?wsdl"><br /><!--- CF7 ---><br /><cfset createObject("java", "coldfusion.server.ServiceFactory").<br />XmlRpcService.refreshWebService(wsAddress) />



Leave a Reply, pub-3772983857049267, DIRECT, f08c47fec0942fa0
%d bloggers like this: