The webservice calls know nothing about each other. There's no persistence
between the calls so this.myVar doesn't exist in the second call.

If func1 needs to be called before func2 you may have to call func1 from
within func2.

Ade

-----Original Message-----
From: C. Schmitz [mailto:[EMAIL PROTECTED]
Sent: 31 October 2003 12:34
To: [EMAIL PROTECTED]
Subject: [CFCDev] this-scope in webservices


Hi all,

in a common CFC, I can set or change a var in the this scope in one method
and re-use it in another method. Assuming that I instantiate the CFC and
call method 1 before method 2, the following will work:

CFC:
<cfcomponent>
   <cffunction name="func1" access="public" returntype="string">
      <cfset this.myVar="abc">
      <cfreturn >
   </cffunction>

   <cffunction name="func2" access="public" returntype="string">
        <cfset newVar = this.myVar>
      <cfreturn newVar>
   </cffunction>
<cfcomponent>


CFM:
<cfobject component="testcfc.cfc" name="myCFC">
<cfinvoke component="#myCFC#" method="func1" returnvariable="anothervar">
<cfinvoke component="#myCFC#" method="func2" returnvariable="myNewVar">
<cfdump var="#myNewVar#">


Now, if I change the access attribute to "remote" and call it as a web
service, the method call of "func2" will throw an error that "MYVAR is
undefined in THIS[]"

Is this a intended behaviour (because of whatever must be in web services),
am I just missing something obvious here, or could it be a bug?

Thanks,

Chris



----------------------------------------------------------
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).

An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]
----------------------------------------------------------
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).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to