84
Designing a Service's Interaction Layer
extends another exception, such as
RootException
, then when the service throws
CityNotFoundException,
methods and properties inherited from
RootException
are
not
passed to the client.
E
The exception stack trace is not passed to the client.
The stack trace for an exception is relevant only to the current execution envi
ronment and is meaningless on a different system. Hence, when a service throws
an exception to the client, the client does not have the stack trace explaining the
conditions under which the exception occurred. Thus, you should consider
passing additional information in the message for the exception.
Web service standards make it easier for a service to pass error conditions to a
client in a platform independent way. While the following discussion may be of
interest, it is not essential that developers know these details about the J2EE plat
form's error handling mechanisms for Web services.
As noted previously, error conditions are included within the SOAP messages
that a service returns to clients. The SOAP specification defines a message type,
called
fault
, that enables error conditions to be passed as part of the SOAP
message yet still be differentiated from the request or response portion. Similarly,
the WSDL specification defines a set of operations that are possible on an end
point. These operations include
input
and
output
operations, which represent the
request and response respectively, and an operation called
fault
.
A SOAP
fault
defines system level exceptions, such as
RemoteException
,
which are irrecoverable errors. The WSDL
fault
denotes service specific excep
tions, such as
CityNotFoundException
, and these are recoverable application error
conditions. Since the WSDL
fault
denotes a recoverable error condition, the plat
form can pass it as part of the SOAP response message. Thus, the standards
provide a way to exchange fault messages and map these messages to operations
on the endpoint.
Code Example 3.13 shows the WSDL code for the same weather Web service
example. This example illustrates how service specific exceptions are mapped
just like input and output messages are mapped.
...
footer
Our web partners:
Inexpensive
Web Hosting
Java Web Hosting
personal webspace
webspace php
linux webhost
html web templates
DreamweaverQuality Web Templates
PSD Web Templates
cheap webhost
j2ee web Hosting
buy webspace
ftp webspace
adult webspace
frontpage WebHosting
webspace hosting
cheap webhost
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved
webhosting