Newbie question. I test the following code with Python built-in HTTP server. It is able to talk to HTTP server.
However, when I terminate the HTTP server, the exception code is not run. Instead, I always get the standard Zato exception response (and error entry in the zato server log.)
please post the actual code of your service - this looks like an extract that is not valid Python code plus the snippet you posted won’t trigger ZatoException under any circumstances so it’s quite difficult to say what would happen in your real service.
(Zato 2.0.7, installed from quickstart, is run within Virtualbox VM. This connection calls
Python built-in HTTP Server being running on the host Windows laptop.)
from future import absolute_import, division, print_function, unicode_literals
from zato.server.service import Service
from zato.common import ConnectionException, HTTPException, ZatoException
class TryHttpSysDown (Service):
name = “tutorial.http-server-down”
… you are only getting a handle to a connection object, you are not invoking anything yet. You are just getting an object from cache that can be later used for issuing HTTP calls.
This line:
conResult = tgt.conn.get(self.cid)
This is the one that actually issues a GET request and this is what can return an exception, but not the previous one.
I think it would be clearer if you were, for instance, using POST instead of GET but here you have two .get calls and you were expecting for the first to already issue a remote call but this is not the case.