|
| Re: Error handling and connection querying |
 |
Fri, 1 Feb 2008 15:04:59 -0800 |
Hello,
Underneath the cover Delphi SOAP uses WinInet (or Indy - configurable by
rebuilding SOAPHTTPTrans). We check for errors from these API. But if you
want to validate a connection you can do that before invoking a WebService
method. You can use API like InternetGetConnectedState and
InternetCheckConnection to ensure an internet connection and a connection to
a specific host respectively.
All error codes are raised as Exceptions by the SOAP runtime. If the Server
returns a SOAP fault we also raise an exception. You can handle specific
exception types for each kind of failure - including SOAPFault types
generated by the importer from the WSDL of the WebService.
Let us know if you need more details.
Cheers,
Bruneau.
|
| Post Reply
|
| Error handling and connection querying |
 |
Fri, 1 Feb 2008 15:49:22 -0000 |
Hi,
I would be interested to learn a little more about how errors are handled
with web services. When a web service is connected to using statements like
HTTPRIO:= THTTPRIO.Create(nil);
MyInterface:= HTTPRIO as IMyInterface;
Info:= MyInterface.MethodA('Data');
there are many possible sources of error, including:
a) Not possible to connect to a web server at the Domain/hostname specified
b) Web server connected to successfully but web server cannot find a code
module at the URL specified (possibly because the file has been moved or
deleted)
c) Code module found successfully but an exception is raised within the
server
. This could be due to an error within the server itself or due to an error
in connecting to a back-end server like a COM server or a database server
d) etc.!
I presume that any errors arising on the round trip will be notified back to
the THTTPRIO proxy server in the form of a string incorporated in the SOAP
response message, whereupon the proxy server will raise a corresponding
exception object in the client module. This will be trapped by the first
exception handler that is found in the call stack. If the code I gave above
is not wrapped in a try .. except construct, the exception will be trapped
by the Application object and notified to the user. However this can all
take a long time!
My question, therefore, is this. Is it possible to check/query whether or
not a web service at a specified URL is reachable before calling one of its
methods? As an analogy, one can check for the existence of a file on the
client computer using the Delphi FileExists function before attempting to
open the file. In the Windows shell one can check whether a computer is
available at a given IP address by using the ping command. So are there
similar facilities with web services?
Regards,
EM
|
| Post Reply
|
|
|
|
|
|
|
|
|
|