Chapter 5 Client Design
231
have a strategy for your client application to deal with these situations. For example,
with these types of errors, it may be useful to have the client application prompt the
user to retry the operation or redirect the user to an alternative service, if possible.
Many times the only solution is to display the exception occurrence to the end user.
Sometimes it may be appropriate to translate the system exception to an unchecked
exception and devise a global way to handle them. The exact solution is particular to
each application and situation.
System exceptions, which the client receives as 
RemoteException
, arise from
a variety of reasons. Often system exceptions happen because of network failures
or server errors. They also may be the result of a SOAP fault. Since a
RemoteException
 usually contains an explanation of the error, the application can
use that message to provide its own error message to the user and can prompt the
user for an appropriate action to take. If an EJB component client is doing its work
on behalf of a Web tier client, the EJB client should throw an exception to the Web
tier client. The Web tier client notifies the user, giving the user a chance to retry
the action or choose an alternative action.
When communicating using stubs, most system exceptions involve network
issues or the configuration of the stub. A configuration error is thrown from the
_getProperty
 and 
_setProperty
 methods as a 
javax.xml.rpc.JAXRPCException
and indicates a property name that is not supported or is invalid, a property setting
value that is not allowed, or a type mismatch.
When using a dynamic proxy, the 
getPort
 method may throw a
javax.xml.rpc.ServiceException
 if the WSDL document has insufficient meta 
data to properly create the proxy.
A client may receive several different exceptions when using the DII 
Call
interface. A client may receive a 
RemoteException
 if a network failure occurs. A
client may also be thrown a 
javax.xml.rpc.JAXRPCException
 if the 
Call
 set
methods use invalid property names or try to set properties with invalid values.
For example, a client application accessing an order tracking service may
want to use an alternative service or endpoint if it receives a 
RemoteException
indicating the unavailability of the service. 
Web components may leverage the servlet error messaging system and map
the 
RemoteException
 to some exception handling instructions in the 
web.xml 
file.
The client can throw its own 
javax.servlet.ServletException
 and can display a
general application error message. It is possible to extend 
ServletException
 to
create a set of application specific exceptions for different errors. It may also use
the file to define a specific error JSP to handle the error, as shown in Code
Example 5.14.






New Page 1








Home : About Us : Network : Services : Support : FAQ : Control Panel : Order Online : Sitemap : Contact : Terms Of Service

java web hosting

 

 

 Our partners: | PHP: Hypertext Preprocessor | Best Web Hosting | Java Servlet Web Hosting | Inexpensive Web Hosting |

Jsp Web Hosting | Cheapest Web Hosting | Jsp Hosting | Cheap Hosting

 

Virtualwebstudio. Business web hosting division of Web Design Plus. All rights reserved