I posted this on cfcdev a while back and heard nothing, so I thought I'd
try here.

  Is there a way to maintain state between web service requests?  I've done
some searching for answers, but haven't found anything related to this.

  Obviously since I'm posting here, I'm building the web services in
CF.  J2EE sessions are enabled, so I figured I could just return the
JSessionID from an initial request, and have the user pass it on to all
future requests as an argument. Then in the method I could do something
along the lines of:

  <cfset session.jsessionID = arguments.jsessionID>

  And hijack the previous session.  It's apparently not that easy.  This is
what I've discovered:

  If I return the text from the session scope I get the URLToken and a
SessionID variable (Not JsessionID).
  The URL token contains the CFID, CFTOKEN, and JSessionID values in it.  I
had thought CFID and CFToken were not supposed to be set if J2EE sessions
were enabled.

  The cookie scope contains the CFID and CFToken value. No JSessionID.

  Here is the code I'm using to return session  / cookie scopes:

WebService.cfc
<cfcomponent output="no">

<Cffunction name="GetScopes" access="remote" output="false"
returntype="string">

  <cfset var result = "">

<cfloop collection="#session#" item="Test">
         <cfif IsStruct(StructFind(session, test))>
                 <cfset Result = Result & test & "Structure<Br>">
         <cfelseif IsArray(StructFind(session, test))>
                 <cfset Result = Result & test & "Array<Br>">
         <cfelse>
                 <cfset Result = Result & test & StructFind(session, test)
& "<BR>">
         </cfif>
</cfloop>

<cfset Result = Result & "<Br><Br>">
<cfloop collection="#cookie#" item="Test">
         <cfif IsStruct(StructFind(cookie, test))>
                 <cfset Result = Result & test & "Structure<Br>">
         <cfelseif IsArray(StructFind(cookie, test))>
                 <cfset Result = Result & test & "Array<Br>">
         <cfelse>
                 <cfset Result = Result & test & StructFind(cookie, test) &
"<BR>">
         </cfif>
</cfloop>

<Cfreturn Result>

</cffunction>
</cfcomponent>

The Application.cfm does a lot of stuff, but here is the cfapplication tag:

<cfapplication
         name="vanilladmin"
         clientmanagement="no"
         sessionmanagement="yes"
         setclientcookies="yes"
         setdomaincookies="no">

  Does anyone have any thoughts they wish to share or resources they wish
to point me at?

--
Jeffry Houser, Web Developer, Writer, Songwriter, Recording Engineer
AIM: Reboog711  | Phone: 1-203-379-0773
--
My Books: <http://www.instantcoldfusion.com>
My Recording Studio: <http://www.fcfstudios.com>
My Energetic Acoustic Rock Band: <http://www.farcryfly.com>
--
When did Reality Become TV
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to