views:

245

answers:

3

I have a web service setup for on a small part of a website and while the site overall gets a good amount of traffic this particular service does not. Once a day when I go to send a request through the web service it will fail on the first attempt, but retrying the request a second time works just fine. It's as if it was no longer cached in memory and times out while starting up.

Is there a way to keep this service active either on my end or on the web service provider's end which is also CF app (separate division of our company)? It's a bit hard to troubleshoot because it only happens once after a long period. And I don't want to setup a separate process just to keep pinging this service.

+1  A: 

Try increasing the requesttimeout and see if that helps.

rip747
+4  A: 

If the server is being restarted regularly between calls to the template, ensure the "save class files" setting is enabled in the administrator (under caching) to prevent the template from being recompiled after each server reload.

Justin Scott
+1  A: 

You can try to use following method on a webservice client side. CF7+ got built-in coldfusion.server.ServiceFactory Java service.

Code can look like

<cftry>
    <!--- here goes attempt to invoke service method, maybe dummy "ping" --->
<cfcatch type="any">
    <!--- trying to refresh WSDL --->
    <cfset createObject("java","coldfusion.server.ServiceFactory").XmlRpcService.refreshWebService(ServiceURL) />
</cfcatch>
</cftry>
<!--- usual code --->

Hope this helps.

Note: this factory contains a lot of useful methods, but almost zero documentation over the internet. Good idea would be to dump it and explore a bit.

Sergii