This content has been marked as final. Show 3 replies
Write 3 functions.
Make function 1 available as a web service. Don't allow cflocation.
Make function 2 available only to the cf server. Allow cflocation
Make function 3 available only to your cfc. Include all the code that's required by functions 1 and 2.
> I have a CFC that can use CFLOCATION under certain conditions.
Your problem is not the "called locally" vs "called as a web service"
thing, it's that you have a CFLOCATION within a CFC method. Redirection on
success or failure (which is what I presume is going on here) should be the
domain of the calling environment, not the method being called. The proof
of this is your very situation: you've now got a method that doesn't work
when called remotely. Quite loosely speaking in the MVC context, you have
a model process doing the work of the controller: it's doing the work *and*
choosing what to do with said work. Those should be two separate bits of
I recommend retasking your code to have the CFLOCATION in the environment
which is working with web pages, and refactor the CFC to provide the
information to make the choice as to redirect or not; which when called as
a web service provides the information to make some other decision not
related to redirection.
However, to answer your actual question: isSoapRequest():
Ah that is what I needed thanks.