Erik Hollensbe
4/4/2006 2:12:00 PM
On 2006-04-03 01:47:03 -0700, fish man <danperrett07087@yahoo.com> said:
> Hi quick question, I have a soap server and soap client ruby scripts.
>
> When I try to run the soap client without starting up the up the server
> the client program crashes out, as you would expect. But I'd like to
> catch that exception and wait 5 min's before it tries again.
>
>
A couple of thoughts that are non-specific to the SOAP modules:
Try rescuing on Exception instead of SystemExit... If that fixed your
troubles, then you know you're catching the wrong exception. Another
important thing to do (obviously) is read the information on whatever
is terminating execution.
Aside, your timeout is not going to ensure trying 3 times. It will wait
900 seconds, but depending on how long the connection takes to timeout,
your 300 second sleep will cause more troubles.
What might be better is something like this:
3.times do
begin
@soap_wrp = SOAP::Stuff # fill in your driver here
rescue Exception => e
puts e # for debugging
end
end
exit(-1) unless @soap_wrp # @soap_wrp is nil, we are not connected
# rest of code..
This may look just like a shorter solution, but it solves a lot of
potential problems due to eliminating unnecessary complexity.