Re-Opening Web Services in Coldfusion using Application.cfc

When you run your Coldfusion App using Application.cfc with an onRequest() method, you’ll soon discover that your web services no longer function.

In my mind this is a bug in CF, but be that as it may, here’s how you get arround it:

Inside your onRequestStart method, add the following lines.

        <!— Define arguments. —>
        <cfargument name=”TargetPage” type=”string” required=”true” />
        <!— Open Webservices —>
        <cfif REFindNoCase( “.cfc$”, ARGUMENTS.TargetPage )>
            <!— Since this is a web service call, we need to get rid of the OnRequest() event method.—>
            <cfset StructDelete( VARIABLES, “OnRequest” ) />
            <cfset StructDelete( THIS, “OnRequest” ) />
        </cfif>

One thought on “Re-Opening Web Services in Coldfusion using Application.cfc

Leave a Reply

Your email address will not be published. Required fields are marked *