To check if it's called as a web service directly you should be able to
check CGI.SCRIPT_NAME or GetBaseTemplatePath().  If these point to the CFC,
then it's a web service, otherwise it's something else.

The something else can then be either a Flash Remoting call or an internal
call.  To check if it's a Flash Remoting call you can look for the built in
"Flash" scope which will only exist for FR calls.  an IsDefined() check can
be spoofed, so this bit of code is more secure.  However, it uses
undocumented functions so may not work in a future version:

 <cfcomponent>
    <cffunction name="isFlashCall" returnType="boolean" access="remote"
output="true">
        <cfset var fs =
            getPageContext().SymTab_findBuiltinScope("Flash")>
        <cfreturn isDefined("fs")>
    </cffunction>
</cfcomponent>

And if it doesn't fall into one of these two categories, then it has to be
an internal call.

Another (less kludgy) way you could do it is by creating an actual worker
CFC which has access="package".  Then you have an "internal" cfc that has
access="public" which your local code uses and you have a remote cfc that
has access="remote" for web services calls.  These proxy cfcs can forward
the request on to the worker cfc and add a new param that says who called
it.

HTH,

Sam


 -----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of
DDE
Sent: Wednesday, May 28, 2003 3:42 AM
To: [EMAIL PROTECTED]
Subject: [CFCDev] CFC or Web Service invocation




Must be simple, but can't find the best way to know inside my CFC if it was
called "internally" by my application or invoked as a Web Service by another
application. I guess I read about sending it as a string, but in the case it
is called by CFMX, it makes some overhead to convert it to string in the
calling app and back to XML doc in the web service.

Thanks
Dominique


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

Reply via email to