Added some debug messages and fixed a bug where the 'connection refused' exepction was not being catched by the WebService api.