SOAPBodyElement

   
SOAPBody javax.xml.soap

SAAJ 1.1; JWSDP 1.0, J2EE 1.4
 public interface SOAPBody extends SOAPElement {  // Public Instance Methods  public abstract SOAPBodyElement addBodyElement(Name   name   )          throws SOAPException;      public abstract SOAPFault addFault(  ) throws SOAPException;      public abstract SOAPFault getFault(  );      public abstract boolean hasFault(  );  } 

SOAPBody is a subinterface of SOAPElement that represents the body of a SOAP message. A single SOAPBody element will always be found as either the first or second element of the SOAPEnvelope , depending on whether the enclosing message has associated headers.

A SOAPBody element may contain any number of SOAPBodyElement s that represent the information to be sent to the message recipient. These elements can be created and added to the body in a single operation by calling addBodyElement( ) or the addChildElement( ) method inherited from SOAPElement . SOAPElement s obtained from a SOAPFactory or from the SOAPElementFactory class may also be added to the message body. However, in this case, since every immediate child of SOAPBody must be a SOAPBodyElement , a copy of the element (and any child elements it may contain) is made in which the original element is replaced by a SOAPBodyElement , and the copied hierarchy is added to the message body.

SOAPBody may also contain a single SOAPFault element if the message is reporting an error encountered while processing the headers or body of an earlier message. The addFault( ) method creates and adds a SOAPFault element to the message body. Application code is responsible for properly initializing this object, as described in the reference entry for SOAPFault , later in this chapter. A message recipient can determine whether the body contains a fault element by calling hasFault( ) , and can obtain a reference to it from the getFault( ) method, which returns null if there is no such element in the body.

Returned By

SOAPEnvelope.{addBody( ) , getBody( )}


   


Java Web Services in a Nutshell
Java Web Services in a Nutshell
ISBN: 0596003994
EAN: 2147483647
Year: 2003
Pages: 257
Authors: Kim Topley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net