Describe how to handle the various types of return values, faults, errors, and exceptions that can occur during a Web service interaction.

A Handler class must implement the javax.xml.rpc.handler.Handler interface:

package javax.xml.rpc.handler;

public interface Handler {
	boolean handleRequest(MessageContext context);
	boolean handleResponse(MessageContext context);
	boolean handleFault(MessageContext context);
	// ...

The handleRequest, handleResponse and handleFault methods for a SOAP message handler get access to the SOAPMessage from the SOAPMessageContext. The implementation of these methods can modify the SOAPMessage including the headers and body elements.

The handleRequest method performs one of the following steps after performing handler specific processing of the request SOAP message:

The handleResponse method performs the processing of the SOAP response message. It does one of the following steps after performing its handler specific processing of the SOAP message:

The handleFault method performs the SOAP fault related processing. The JAX-RPC runtime system should invoke the handleFault method if a SOAP fault needs to be processed by either client-side or server-side handlers. The handleFault method does one of the following steps after performing handler specific processing of the SOAP fault:

Please note that when a JAXRPCException or RuntimeException raised on the server is converted to a SOAP fault for the purpose of being transmitted to the client, there are no guarantees that any of the information it contains will be preserved.

The following shows an example of the SOAP fault processing. In this case, the request handler Handler_2 on the server side throws a SOAPFaultException in the handleRequest method:

  1. Handler_1.handleRequest

  2. Handler_2.handleRequest -> throws SOAPFaultException

  3. Handler_2.handleFault

  4. Handler_1.handleFault

Professional hosting     Belorussian informational portal         Free SCWCD 1.4 Study Guide     Free SCBCD 1.3 Study Guide     SCDJWS 1.4 Quiz     Free IBM Certified Associate Developer Study Guide     Free SCJP 5.0 (Tiger) Study Guide     Free Mock Exam Engine     IBM Test 000-287. Enterprise Application Development with IBM WebSphere Studio, V5.0 Study Guide     IBM Test 000-255. Developing with IBM Rational Application Developer for WebSphere Software V6 Study Guide

webhosting provided by ixvar inc