Flylib.com

Books Software

 
 
 

Package javax.xml.rpc.soap

   

Chapter 19. The javax.xml.rpc.soap Package

Package javax.xml.rpc.soap

SOAPFaultException


   
   
Package javax.xml.rpc.soap

JAX-RPC 1.0; JWSDP 1.0, J2EE 1.4

This package contains classes from the client-side JAX-RPC API that are specific to the use of this API when SOAP is used as the underlying message transport (which, at the time of this writing, is exclusively the case). In JAX-RPC 1.0, there is only one class in this package.

Exceptions

public class

SOAPFaultException

extends RuntimeException;

   
   
SOAPFaultException javax.xml.rpc.soap

JAX-RPC 1.0; JWSDP 1.0, J2EE 1.4 serializable unchecked
public class SOAPFaultException extends RuntimeException {

// Public Constructors

public SOAPFaultException( javax.xml.namespace.QName


faultcode


, 
        String


faultstring


, String


faultactor


, javax.xml.soap.Detail


faultdetail


);

// Public Instance Methods

public javax.xml.soap.Detail getDetail(  ); 
    public String getFaultActor(  ); 
    public javax.xml.namespace.QName getFaultCode(  ); 
    public String getFaultString(  ); 
}

SOAPFaultException is an unchecked exception that is thrown from a method call on the client side that results in the server returning a SOAP message that contains a fault element. The methods from which such a fault can be thrown are the invoke( ) method of the Call interface, and any method in the service endpoint interface of a web service for which the WSDL definition allows the response to contain a fault element.

The methods of SOAPFaultException allow the client application to retrieve the information conveyed in the fault message (for a discussion of this, refer to the description of the SOAPFault element in the SAAJ API in Chapter 20). The getFaultCode( ) and getFaultString( ) methods retrieve the reason for the fault as an error code and a human-readable string, respectively, while the getFaultActor( ) method returns a URI that identifies the system that detected the fault. The getDetail( ) returns additional information, which is application-specific, that the sender stored in the SOAP fault element. The value returned by this method is of type javax.xml.soap.Detail (see Chapter 20) and can, therefore, contain arbitrary XML elements.


   
   

Chapter 20. The javax.xml.soap Package

Package javax.xml.soap

AttachmentPart

Detail

DetailEntry

MessageFactory

MimeHeader

MimeHeaders

Name

Node

SOAPBody

SOAPBodyElement

SOAPConnection

SOAPConnectionFactory

SOAPConstants

SOAPElement

SOAPElementFactory

SOAPEnvelope

SOAPException

SOAPFactory

SOAPFault

SOAPFaultElement

SOAPHeader

SOAPHeaderElement

SOAPMessage

SOAPPart

Text


   
   
Package javax.xml.soap

SAAJ 1.1; JWSDP 1.0, J2EE 1.4

The javax.xml.soap package contains the classes and interfaces that make up the Soap with Attachments API for Java (SAAJ). This package can be divided into two major parts : a small number of classes and interfaces that obtain a SOAP message and send it, and a much larger set that deal with the structure of the message itself.

In order to send a message, you need to get an instance of the SOAPConnection class. As is the case with most of the classes in this package, this class is abstract in order to allow vendors to provide their own implementations . You can obtain a SOAPConnection object from the SOAPConnectionFactory class, which is another abstract class that you can get an instance of by calling its newInstance( ) method. A SOAP message is represented by the SOAPMessage class, which can be obtained from a MessageFactory .

SOAP messages are built from elements that are represented in the API by the SOAPElement interface. This interface provides methods that allow you to add other elements and text nodes to form a tree structure that is serialized to XML form when the message is transmitted. Similarly, on receipt, a SOAP message is converted from XML form to a SOAPMessage consisting of SOAPElement s and Text nodes. SOAPElement has various subinterfaces that represent different parts of the SOAP message, such as SOAPHeader , SOAPBody , and SOAPFault .

The body of a SOAP message can only contain valid XML data. Non-XML data can be included by adding one or more attachments. SAAJ supports the use of attachments that contain MIME-encoded data. To add such an attachment, create an AttachmentPart object, specifying the data content and its MIME type, and attach it to the message.

Interfaces

public interface

Detail

extends SOAPFaultElement;
public interface

DetailEntry

extends SOAPElement;
public interface

Name

;
public interface

Node

;
public interface

SOAPBody

extends SOAPElement;
public interface

SOAPBodyElement

extends SOAPElement;
public interface

SOAPConstants

;
public interface

SOAPElement

extends Node;
public interface

SOAPEnvelope

extends SOAPElement;
public interface

SOAPFault

extends SOAPBodyElement;
public interface

SOAPFaultElement

extends SOAPElement;
public interface

SOAPHeader

extends SOAPElement;
public interface

SOAPHeaderElement

extends SOAPElement;
public interface

Text

extends Node;

Classes

public abstract class

AttachmentPart

;
public abstract class

MessageFactory

;
public class

MimeHeader

;
public class

MimeHeaders

;
public abstract class

SOAPConnection

;
public abstract class

SOAPConnectionFactory

;
public class

SOAPElementFactory

;
public abstract class

SOAPFactory

;
public abstract class

SOAPMessage

;
public abstract class

SOAPPart

;

Exceptions

public class

SOAPException

extends Exception;