Chapter 5 Client Design
233
This exception mapping mechanism may not be used with DII, since this
communication mode returns all exceptions as 
java.rmi.RemoteException
. Note
that there is no guarantee that the JAX RPC runtime system will throw a
ServiceException
 for a specific 
wsdl:fault
 error. The runtime may instead
throw a 
javax.xml.rpc.soap.SOAPFaultException
 runtime exception.
Use the JAX RPC tools to map faults to Java objects. (See  WSDL to Java
Type Mapping  on page 225.) These tools generate the necessary parameter map 
pings for the exception classes and generate the necessary classes for the map 
ping. Generated exceptions classes extend 
java.lang.Exception
. The client
application developer is responsible for catching these checked exceptions in a
try
/
catch
 block. The developer should also try to provide the appropriate applica 
tion functionality to recover from such exceptions. For example, an order tracking
client might include the code shown in Code Example 5.15 to handle cases where
a matching order is not found. The order tracking service threw an
OrderNotFoundException
, and the client presented the user with a GUI dialog
indicating that the order was not found.
try {
OrderDetails od = service.getOrderDetails(orderId); 
} catch (OrderNotFoundException onx) {
JOptionPane.showMessageDialog(gui, 
"Order Not found with Order ID " + orderId, "Error",
JOptionPane.ERROR_MESSAGE);
}
Code Example 5.15
J2SE Client Displaying an Error
A J2EE Web component client may handle the exception using the facilities
provided by the J2EE environment. The client may wrap the application exception
and throw an unchecked exception, such as a 
javax.servlet.ServletException
,
or it may map the exception directly to an error page in the Web deployment
descriptor. In Code Example 5.16, the client maps the 
OrderNotFoundException
directly to a JSP. Clients should always provide human readable messages and
give the user the ability to return to an entry page.
com.sun.blueprints.adventure.
OrderNotFoundException






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