SOAP - Problem with separate threads
Dave
dave at looktowindward.com
Tue Oct 23 07:29:14 EDT 2007
Hi All,
I have implemented some SOAP calls and it all works fine, except that
I have need to send Poll to the server every so often. When the timer
goes off, it makes a call to the SOAP Library, this too works fine
unless you do something in the user window that causes another SOAP
library call to be made while the timer thread is sending a poll.
What is the best way to handle this?
I was thinking I'd add this to the start of the function copied below:
local sgInUseFlag -- A Stack Global
repeat while sgInUseFlag = true
wait 10 milliseconds
end repeat
put true into sgInUseFlag
Then at the end:
put false into sgInUseFlag
Will this work? Is there a better way to handle this?
All suggestions and advice greatly appreciated.
All the Best
Dave
------------------------------------------------------------------------
---------
--
-- LibSoapSendRPCRequest
--
------------------------------------------------------------------------
---------
function LibSoapSendRPCRequest
theSoapID,theSoapAction,theMethod,theHeader,theParams, at theSoapReply
local mySOAPEnvelope
local mySoapURL
local mySoapNameSpace
local myNameSpaceMethod
local mySoapResponse
local myHTTPHeader
--
-- Get the Session Parameters
--
get LibSoapGetSessionParameters
(theSoapID,mySoapURL,mySOAPEnvelope,mySoapNameSpace)
--
-- Substitute the fields in the Prototype Soap Envelope
--
put theMethod && "xmlns=" & quote & mySoapNameSpace & quote into
myNameSpaceMethod
replace "<$METHOD>" with "<" & myNameSpaceMethod & ">" & cr in
mySOAPEnvelope
replace "</$METHOD>" with "</" & theMethod & ">" in mySOAPEnvelope
replace "<$PARAMS/>" with theParams in mySOAPEnvelope
replace "<$HEADER>" with theHeader in mySOAPEnvelope
--
-- Post the Request
--
put _LibSoapGetHTTPHeaders(mySOAPEnvelope,mySoapNameSpace & "/" &
theSoapAction) into myHTTPHeader
set the HTTPHeaders to myHTTPHeader
--libUrlSetSSLVerification false
try
post mySOAPEnvelope to url mySoapURL
--
-- Catch Time-Out Errors
--
catch myError
answer myError
breakpoint
return mySoapResponse
end try
--
-- Retreive Results
--
put it into theSoapReply
put the result into mySoapResponse
return mySoapResponse
end LibSoapSendRPCRequest
More information about the use-livecode
mailing list