8 Replies Latest reply on Mar 10, 2007 9:22 AM by theMan

    web services and sessions

      how to maintain a session with coldfusion web service?
        • 1. Re: web services and sessions
          Can you please post the reason why you would want that?
          • 2. Re: web services and sessions
            insuractive Level 3
            Many sites handle this by generating a transaction key on the intial web service contact and then forcing the client to echo the transaction key back for every web service method called. You could then store your CF variables in a database using the transaction key as the way to store/retrieve them. Easiest way would be to serialize a CF structure using <cfwddx>. Given, you wouldn't be using your typical coldfusion session variables (which I don't think you could use anyway via webservice as there is no way to id the session) - but it should work about the same. You would just need to schedule a task to go through and remove old data on a regular basis, as the "session" data would eventually fill your DB.
            • 3. Re: web services and sessions
              Level 1
              Too bad there is not a single example of transactional web service that ships with ColdFusion 7... Thanks.
              • 4. Re: web services and sessions
                Level 1
                How do you expose web service for complex business log using bunch of web service functions (without transactions)? You really can't with or can you?
                • 5. Re: web services and sessions
                  BrainSan Level 1
                  You can try partial transactions.
                  Altho you need alot of logic in handling the return values.
                  Insuractive gave you a rather good solution.
                  Use UUID's to communicate between the webservices to handle the data that was parsed before.
                  • 6. Re: web services and sessions
                    edgriffiths Level 1
                    Insuractive's described method works well with CF. We use a login() method (accepts username and password, creates session, sets session.isLoggedIn flag) to return a jsessionid to the webservice consumer.

                    The consumer then passes the jsessionid back to CF on each subsequent request: CF checks the jsessionid for validity on each request.

                    CF uses createObject("java", "coldfusion.runtime.SessionTracker").getSession("YOUR_CFAPPLICATION_NAME_" & jsessionid) to grab the WS consumer's session data from the JVM.
                    • 7. Re: web services and sessions
                      Can I pass session variables form asp to coldfusion? We are exploring using external authentication from a company that uses asp. Can logging in successfully from asp externally then pass session variables to the member area of our site, especially with different levels of users?

                      • 8. Re: web services and sessions
                        Level 1
                        Could you send me full example of client.cfm and server.cfc code, please? Thanks so much. Dariusz.