Author | Topic: Session Context data lost (NIL) | |
---|---|---|
Robert Major | Session Context data lost (NIL) on Tue, 03 May 2005 12:52:33 -0400 Can anyone indicate what to check for lost data when using context management sessions: 1) The browser is enabled for cookies and JavaScript. This is checked by writing a cookie using JScript and verifying its presence. 2) The waa1srv.dbf has all the context data stored and can be extracted with all required variables set by using oContext:setCargo() But oContext:getCargo() fails with the attempted retrieval yielding NIL for setCargo variables. I have 2 cases in 2 different environments. Both have Apache and WAA working and tested Ok for basic connection, etc. In one case, there is no problem using the DLL packages to use the full range of functions and getting getCargo() variables. So I know there is no real problem with the DLL code itself. In the other case, using the same DLL packages, getCargo fails to retrieve the cargo data and returns NIL for all stored variables. It seems that WAA is not getting the correct waa1srv.dbf record, or not getting any record, for some reason... There must be a difference in environments either at the HTML server or WAA server, or other firewall, security, etc. that prevents the package DLL to correctly retrieve the cargo data. Any help would be appreciated. For example, how could I verify what WAA is doing when/if seeking the waa1srv.dbf for context data? Robert | |
Frans Vermeulen | Re: Session Context data lost (NIL) on Wed, 04 May 2005 09:39:18 +0200 Robert, > Can anyone indicate what to check for lost data when using > context management sessions: I can remember having run into a same or similar problem. This was however with a former employer, and I haven't used WAA for 3 years now in a professional sense. IOW, I forgot what it was, and whether or not I found the solution. Somewhere in the crypts of this newsgroup, there must be buried some tools that allow you to study the anatomy of, and perform surgery on the oContext object. Also setting the logging level high might point at the defect. The obvious question is of course: What WAA version are you using ? Regards, Frans Vermeulen | |
Phil Ide | Re: Session Context data lost (NIL) on Wed, 04 May 2005 10:19:40 +0100 Robert, > Can anyone indicate what to check for lost data when using > context management sessions: Write some code in your form-function that logs the session-id to a file. You can then shutdown WAA and open the database and see if the appropriate reciords exists, whether there are duplicate session-id's etc. You could easily write a simple applet to goto a record and extract the session data from a record (it's a simple Var2Bin() of an array) so you can examine the content of different records. Beware also of cookie caching on the client-side - sometimes a client will return a cookie that should have been updated by a concurrent browser window, and of course if you have two browsers sessions running, one will (should) update the cookies for both. Regards, Phil Ide *************************************** * Xbase++ FAQ, Libraries and Sources: * * goto: http://www.idep.org.uk/xbase * *************************************** Unauthorized System Access. Sysop Terminated. | |
Robert Major | Re: Session Context data lost (NIL) on Wed, 04 May 2005 09:12:58 -0400 Hi Frans and Phil, Thanks for the hints. It seems that I found the problem and it is in fact mentioned in this NG somewhere. If the IP address is used in the browser instead of the url, WAA seems to think there is a mismatch and fails to retrieve the context data. BTW, I am using WAA 1.82. Also Phil, how can one retrieve the session id? I could not find that doc'ed anywhere. Regards, Robert | |
Frans Vermeulen | Re: Session Context data lost (NIL) on Wed, 04 May 2005 16:02:55 +0200 Robert, > Thanks for the hints. It seems that I found the problem and > it is in fact mentioned in this NG somewhere. If the IP > address is used in the browser instead of the url, WAA seems > to think there is a mismatch and fails to retrieve the > context data. That was it !!! The IP-Adres is used for creating an identification key somewhere, resulting in variable keylengths which will in one case be padded, in the other case not. Thnx for the answer & Regards, Frans Vermeulen | |
Phil Ide | Re: Session Context data lost (NIL) on Wed, 04 May 2005 16:05:36 +0100 Robert, > Also Phil, how can one retrieve the session id? I could not > find that doc'ed anywhere. For a client that already has a session, and is therefore returning a cookie to the server: oHtml:getCookie() This returns all cookies returned by the client, e.g.: "COOKIE1=xxx;COOKIE2=yyy;COOKIE3=zzz" You need to break each of these apart to get: { {"COOKIE1", 'xxx'} {"COOKIE2", 'yyy'} {"COOKIE3", 'zzz'} } I believe (although I can't check right now) the cookie is called UUID. For new clients (i.e. you've created a new session), look in oHtml:cCookie to see what cookies have been created. Note that the format of cookies is different when setting them, since they may (and probably will) have properties, but these and their format is quite obvious when you look at them. This function will extract a named cookie... call: ExtractCookie("UUID",oHtml:getCookie()) returns: cookie value as string if found empty string if not found Function ExtractCookie(cName, cCookies) local i local cRet := '' if !(cName == NIL) .and. !Empty(cCookies) if (i := At( lower(cName)+'=', lower(cCookies) )) > 0 cRet := SubStr(cCookies,i) if (i := At(';', cRet)) > 0 cRet := Left( cRet, i-1 ) endif i := At('=', cRet) cRet := SubStr( cRet, i+1 ) endif else cRet := cCookies endif return cRet Regards, Phil Ide *************************************** * Xbase++ FAQ, Libraries and Sources: * * goto: http://www.idep.org.uk/xbase * *************************************** Hard work has a future pay-off. Laziness pays off now! | |
Robert Major | Re: Session Context data lost (NIL) on Wed, 04 May 2005 11:19:28 -0400 Hi Phil, > This function will extract a named cookie... That helps and many thanks -- I just hope you are not counting the beers I owe you . Robert | |
Phil Ide | Re: Session Context data lost (NIL) on Wed, 04 May 2005 17:09:24 +0100 Robert, >> This function will extract a named cookie... > > That helps and many thanks -- I just hope you are not > counting the beers I owe you . That function was simply a bastardised version of a method in the iocache class from WAA2. In that method, the cookie string was simply retrieved from the transaction class (if it didn't already exist in the cache), so I only had to change the parameter list and remove a line of code. So, no effort really Regards, Phil Ide *************************************** * Xbase++ FAQ, Libraries and Sources: * * goto: http://www.idep.org.uk/xbase * *************************************** Future: a myth created by guidance councellors and insurance salesmen. |