Date:  07/24/2012 08:25:45 PM Msg ID:  004494
From:  FoxWeb Support Thread:  004489
Subject:  Re: Channel mix up???
Looking at the script, it does not seem possible for it to return "success", unless the request contains the proper data. At the very least, it must contain a form field named "DBF" that is equal to "notes".
 
I realize that you have searched all your scripts for the term success, but I have seen situations where similar searches have failed to pinpoint the culprit. I suggest that you modify the response from the two scripts, so that they return more information, such as the sender's IP address, the request time, etc.. If legitimate requests for SyncDBF always come from a program, it should not matter whether the response contains additional data. The response could also contain additional instructions to forward the response to you if they did not call SyncDBF.
 
You should also check your web server's logs at the time of the error to see if two requests arrived at the same time and could have been criss-crossed. I should repeat that I have absolutely no indication that this has happened before, but the logs may point you in the right direction.
FoxWeb Support Team
support@foxweb.com email
Sent by Ali Koumaiha on 07/24/2012 06:03:20 PM:

Thanks for the reply.  the only global variables i have in my fw_enter.prg are:
gcServerPath, gcDataPath, gcCompID, gcFoxWebPath

i searched all my fwx script (using GoFish4.app) for the keyword "success" and it is only in this script, and another script, just like it.. its is puzzling me..
btw, i modifed my server.AddScriptTimeOut() and i am going to try it out and reduced my script timeout in the config area..


this is my SyncDBF.fwx

<%

local lcStoreID, lcXML, lcTable, lcFile, lcCursor


lcStoreID  = upper(alltrim(Request.Form("StoreID")))
lcXML   = Request.form("XML")
lcTable  = upper(alltrim(Request.form("DBF")))

if UPPER(lcTable) = 'NOTES'
 response.write("SUCCESS")
 RETURN
ENDIF
if empty(lcStoreID)
 response.write("Empty store id")
 return
endif

if empty(lcXML)
 response.write("empty xml file")
 return
endif

if empty(lcTable)
 response.write("empty table name")
 return
endif

if not used('toyzsync')
 use c:\foxweb\toyzsync.dbf in 0
endif



lcCursor = sys(2015)

lcLoc = "\\toyzfinance\finance\toyz" + alltrim(lcStoreID) + "\Data\" + alltrim(lcTable) + ".dbf"
if not file(lcLoc)
 select ToyzSync
 set order to StoreID
 if not seek(lcStoreID)
  append blank
  replace StoreId with lcStoreID
 endif
 replace LastError with datetime()
 replace errorMsg with 'File does not exist: ' + lcLoc

 response.write("File does not exist: " + lcLoc)
 return
endif

lcfile = alltrim(lcStoreID) + SYS(2015)+alltrim(lcTable)+".xml"


try 
 if used(lcTable)
  use in sele(lcTable)
 endif
 use (lcLoc) in 0
 
 
 lcXML = strtran(lcXML,'1.E+6','999')
 lcXML = strtran(lcXML,'8.E+6','999')
 lcXML = strtran(lcXML,'9.E+6','999')
 lcXML = strtran(lcXML,'5.E+6','999')
 lcXML = strtran(lcXML,'3.E+6','999')
 lcXML = strtran(lcXML,'4.E+6','999')
 lcXML = strtran(lcXML,'6.E+6','999')
 lcXML = strtran(lcXML,'7.E+6','999')
 lcXML = strtran(lcXML,'2.E+6','999')
 lcXML = strtran(lcXML,'10.E+6','999')
 lcXML = strtran(lcXML,'<length>**</length>','<length>0</length>')
 lcXML = strtran(lcXML,'<qty>******</qty>','<qty>999</qty>')
 lcXML = strtran(lcXML,chr(2),'')
 lcXML = strtran(lcXML,chr(17),'')
 lcXML = strtran(lcXML,chr(14),'')
 strtofile(lcXML,lcFile)
 xmltocursor(lcFile,lcCursor,512)
 
 
 m.lDel = .f.
 SELECT (lcCursor)
 lnCount = 0
 SCAN
    SCATTER MEMVAR memo
    release m.PKServer && since the table would have one from the store.
    m.PKServer = m.IID  && we want the pkserver to be the IID of the store
    RELEASE m.IID && that's auto inc, so remove it
           m.LastUpdate = date()
    SELECT (lcTable)
    SET ORDER TO pkServer
    IF NOT SEEK(m.pkServer)
  APPEND BLANK
    endif 
    if m.lDel
     Delete
    else 
     GATHER MEMVAR memo
    endif
    lnCount = lnCount + 1
 ENDSCAN
 response.write('SUCCESS')
 *strtofile("storeid: " + lcStoreID + " table: " + lcTable + ' Datetime: ' + ttoc(datetime()) + ' Records: ' + Trans(lnCount) +  chr(10) + chr(13),"c:\sync.txt",1)
 sele ToyzSync
 set order to StoreID
 if not seek(lcStoreID)
  append blank
  replace StoreId with lcStoreID
 endif
 replace LastSync with datetime()
 use in sele('Toyzsync')
 
 use in select(lcCursor)
 use in select(lcTable)
 if file(lcFile)
  erase (lcFile)
 endif
catch to loExp
 response.write('ERROR')
 strtofile("Datetime: " + ttoc(datetime()) + " Store ID: " + lcStoreID + " Table: " + lcTable + " Message: " + loExp.Message + "Line: " + trans(loExp.LineNo) + chr(13)+chr(10),"c:\foxweb\SyncError.txt",1)
 if not used('toyzsync')
  use c:\foxweb\toyzsync.dbf in 0
 endif
 
 sele ToyzSync
 set order to StoreID
 if not seek(lcStoreID)
  append blank
  replace StoreId with lcStoreID
 endif
 replace LastError with datetime()
 replace errorMsg with 'Message: ' + loExp.Message + chr(10) + chr(13) + 'Line: ' + trans(loExp.LineNo)
 use in sele('Toyzsync')
 if file(lcFile)
  erase (lcFile) 
 endif
 use in select(lctable)
 use in select(lcCursor)
 exit 
endtry


%>



Sent by FoxWeb Support on 07/24/2012 03:12:44 PM:
 It is absolutely unheard of for FoxWeb channels to get mixed up and send output to the wrong user.  However, we occasionally receive support calls, describing this exact situation.  The vast majority of these cases involved the inappropriate use of public variables, with a few outliers suffering from other issues, specific to other technologies employed at these sites, such as inappropriately configured load balancers.  For details on the use of public variables in FoxWeb, please refer to http://www.foxweb.com/document/PublicVariables.htm.
FoxWeb Support Team
support@foxweb.com email
Sent by Ali Koumaiha on 07/24/2012 09:51:59 AM:
 I am seeing a strange behavior on one of my client.
they have usre's they use an app that send a small xml to update some tables at the corporate server.  the app post the xml to foxweb. FoxWeb, takes the xml, turns it into a cursor, then, upon success, the fwx script, does:
response.write("success")
the app reads the success reponse and does its thing on the user's end.
Also, there is a Portal system, (other pages) where employees, and users, and customers can view their invoices, have a shopping cart, etc..
some employees that are NOT using the xml scripts at all (and they cannot), are seeing the "success" from another script.
example:
1- POS app posts xml to SyncDBF.fwx
2- SyncDBF.fwx processes the xml and does respone.write("success")
user: navigates the portal and accesses PreviousOrders.fwx 
users: seeing "success" (once in a while).
they sent me a snap shot of the webpage, which is the url has previousorders.fwx, and the only fwx EVER on that server that has "success" as response.write is SyncDBF.fwx
what should I do?