Hi,
I've been working on this, but I still can't get it to work how I
want it to.
I have a series of SOAP requests that much be executed in sequence.
The data received from sending one command is used as a parameter to
the next. As an example, here is the following Pseudo code.
put SendSoapCommand1(myParam) into mySoapReply
if mySoapReply = "type1" then
put SendSoapCommand2 mySoapReply() into mySoapReply
else
put SendSoapCommand3(mySoapReply) into mySoapReply
end if
put SendSoapCommand4(mySoapReply) into mySoapReply
e.g. the data received in one SOAP call is used in a subsequent call.
So what I want is for SendSoapCommandX() to NOT return until the data
has been transfered and the reply received.
How can I achieve this? I really can't see how this can be done using
callbacks. Sorry if I have missed something.
To add further complications, I also need to FTP files to the server.
When I do this, I pause the SOAP Queue timer.
All the Best
Dave
On 24 Oct 2007, at 16:15, Andre Garzia wrote:
Hello Dave,
you can't use wait. Even wait with messages. If you use waits and for
some reason you have nested wait blocks, you need to unblock them from
the inner to the outer or they will still be blocked. With the nature
of your software where you have two streams causing the waits - the
server pool and the actions that cause SOAP requests - this nested
blocks could get really ugly. I try never to use wait in my software.
You mail before this one, you pondered about how to return data to the
function that called the SOAP request. What I'd do is like this, one
of the parameters for the SOAP request function would be a callback.
Like libURL does.
function LibSoapSendRPCRequest
theSoapID,theSoapAction,theMethod,theHeader,theParams,theCallBack
With that you must store in your queue both the callback message and
the target that called the message. When your request is done, you
send the result to the callback message. A simple silly implementation
is below:
local lQueue
on addToQueue pURL, pCallback
put pURL & "|" & pCallback & "|" the long id of the target & cr
after lQueue
end addToQueue
on DownloadNextFile
set the itemdel to "|"
get item 1 of line 1 of lQueue
load URL it with message "downloadComplete"
end DownloadNextFile
on DownloadComplete pURL, pData
set the itemdel to "|"
put format("send %s \"%s\", \"%s\" to %s", item 2 of line 1 of
lQueue, pURL, pDATA, item 3 of line 1 of lQueue) into tCmd
do tCmd
delete line 1 of lQueue
DownloadNextFile
end DownloadComplete
This above is a simple file download queue where each file is
acknowledge by sending a callback message back to the object that
called the addToQueue function. You could use it like this:
addToQueue "http://server/file1", "file1_complete"
addToQueue "http://server/file1", "file2_complete"
And have callbacks on the same object such as these below in the same
object that called the addtoqueue handler.
on file1_complete pURL, pData
-- do stuff for file 1.
end file1_complete
on file2_complete pURL, pData
-- do stuff for file 2.
end file2_complete
I hope you get the idea. Check the docs for more information for the
following commands: send, the target, long id, urlstatus. By combining
this, you can create your own queues. Of course there are others ways
of doing it but this is a quick one.
Cheers
andre
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution