On Thursday, Aug 7, 2003, at 14:25 US/Pacific, Ruggiero, Kevin D. wrote:
> However, I have an ASP.NET application that I'm using to do this same 
> thing,
> and state is NOT preserved between calls- and I don't understand why.

See my other email - Web Services are essentially stateless. Every time 
you call a Web Service, it creates a new instance of the component that 
gets called.

> Is there a way to make my CFC preserve its state between calls from my 
> .NET
> application?  I'm totally stuck here.

What you need is to have a Web Service that is actually a Session 
Fa�ade and then to manage your underlying component's state through 
that. In essence, your Web Service component would cache an instance of 
the 'real' component in some sort of session-based scope and use that 
to execute each actual call.

The next issue is how you maintain 'session' over multiple calls to a 
Web Service. There's a number of ways to this but the simplest way is:
- have a WS method you call to initiate a 'session' and it:
        - allocate a UUID
        - creates an instance of the 'worker' component
        - stores it in application.wsSession[uuid]
        - returns the uuid
- pass the UUID into each WS method
        - method retrieves application.wsSession[uuid]
        - calls worker method on that object
        - returns result

Then you need a scavenger that cleans up (so the initialization should 
probably also store timestamps with the objects and a scheduled task 
can delete them from the application.wsSession array).

Of course, if you've got a way to maintain J2EE session (jsessionid 
cookie) you could use that and plain ol' session scope (Flash lets you 
do this via Flash Remoting for example).

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to