src/share/jaxws_classes/javax/xml/soap/SOAPBody.java

Print this page
rev 507 : 8047724: @since tag cleanup in jaxws
Reviewed-by:


  25 
  26 package javax.xml.soap;
  27 
  28 import java.util.Locale;
  29 
  30 import org.w3c.dom.Document;
  31 
  32 import javax.xml.namespace.QName;
  33 
  34 /**
  35  * An object that represents the contents of the SOAP body
  36  * element in a SOAP message. A SOAP body element consists of XML data
  37  * that affects the way the application-specific content is processed.
  38  * <P>
  39  * A <code>SOAPBody</code> object contains <code>SOAPBodyElement</code>
  40  * objects, which have the content for the SOAP body.
  41  * A <code>SOAPFault</code> object, which carries status and/or
  42  * error information, is an example of a <code>SOAPBodyElement</code> object.
  43  *
  44  * @see SOAPFault

  45  */
  46 public interface SOAPBody extends SOAPElement {
  47 
  48     /**
  49      * Creates a new <code>SOAPFault</code> object and adds it to
  50      * this <code>SOAPBody</code> object. The new <code>SOAPFault</code> will
  51      * have default values set for the mandatory child elements. The type of
  52      * the <code>SOAPFault</code> will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code>
  53      * depending on the <code>protocol</code> specified while creating the
  54      * <code>MessageFactory</code> instance.
  55      * <p>
  56      * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
  57      * child element.
  58      *
  59      * @return the new <code>SOAPFault</code> object
  60      * @exception SOAPException if there is a SOAP error
  61      */
  62     public SOAPFault addFault() throws SOAPException;
  63 
  64 


  73      * <i>Fault/Code/Value</i> element  and the <code>faultString</code> parameter
  74      * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
  75      * the <code>faultCode</code> parameter is the value of the <code>faultcode</code>
  76      * element and the <code>faultString</code> parameter is the value of the <code>faultstring</code>
  77      * element.
  78      * <p>
  79      * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
  80      * child element.
  81      *
  82      * @param faultCode a <code>Name</code> object giving the fault
  83      *         code to be set; must be one of the fault codes defined in the Version
  84      *         of SOAP specification in use
  85      * @param faultString a <code>String</code> giving an explanation of
  86      *         the fault
  87      * @param locale a {@link java.util.Locale} object indicating
  88      *         the native language of the <code>faultString</code>
  89      * @return the new <code>SOAPFault</code> object
  90      * @exception SOAPException if there is a SOAP error
  91      * @see SOAPFault#setFaultCode
  92      * @see SOAPFault#setFaultString
  93      * @since SAAJ 1.2
  94      */
  95     public SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws SOAPException;
  96 
  97     /**
  98      * Creates a new <code>SOAPFault</code> object and adds it to this
  99      * <code>SOAPBody</code> object. The type of the <code>SOAPFault</code>
 100      * will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code> depending on
 101      * the <code>protocol</code> specified while creating the <code>MessageFactory</code>
 102      * instance.
 103      * <p>
 104      * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
 105      * <i>Fault/Code/Value</i> element  and the <code>faultString</code> parameter
 106      * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
 107      * the <code>faultCode</code> parameter is the value of the <code>faultcode</code>
 108      * element and the <code>faultString</code> parameter is the value of the <code>faultstring</code>
 109      * element.
 110      * <p>
 111      * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
 112      * child element.
 113      *
 114      * @param faultCode
 115      *            a <code>QName</code> object giving the fault code to be
 116      *            set; must be one of the fault codes defined in the version
 117      *            of SOAP specification in use.
 118      * @param faultString
 119      *            a <code>String</code> giving an explanation of the fault
 120      * @param locale
 121      *            a {@link java.util.Locale Locale} object indicating the
 122      *            native language of the <code>faultString</code>
 123      * @return the new <code>SOAPFault</code> object
 124      * @exception SOAPException
 125      *                if there is a SOAP error
 126      * @see SOAPFault#setFaultCode
 127      * @see SOAPFault#setFaultString
 128      * @see SOAPBody#addFault(Name faultCode, String faultString, Locale locale)
 129      *
 130      * @since SAAJ 1.3
 131      */
 132     public SOAPFault addFault(QName faultCode, String faultString, Locale locale)
 133         throws SOAPException;
 134 
 135     /**
 136      * Creates a new  <code>SOAPFault</code> object and adds it to this
 137      * <code>SOAPBody</code> object. The type of the <code>SOAPFault</code>
 138      * will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code> depending on
 139      * the <code>protocol</code> specified while creating the <code>MessageFactory</code>
 140      * instance.
 141      * <p>
 142      * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
 143      * <i>Fault/Code/Value</i> element  and the <code>faultString</code> parameter
 144      * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
 145      * the <code>faultCode</code> parameter is the value of the <i>faultcode</i>
 146      * element and the <code>faultString</code> parameter is the value of the <i>faultstring</i>
 147      * element.
 148      * <p>
 149      * In case of a SOAP 1.2 fault, the default value for the mandatory <code>xml:lang</code>
 150      * attribute on the <i>Fault/Reason/Text</i> element will be set to
 151      * <code>java.util.Locale.getDefault()</code>
 152      * <p>
 153      * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
 154      * child element.
 155      *
 156      * @param faultCode
 157      *            a <code>Name</code> object giving the fault code to be set;
 158      *            must be one of the fault codes defined in the version of SOAP
 159      *            specification in use
 160      * @param faultString
 161      *            a <code>String</code> giving an explanation of the fault
 162      * @return the new <code>SOAPFault</code> object
 163      * @exception SOAPException
 164      *                if there is a SOAP error
 165      * @see SOAPFault#setFaultCode
 166      * @see SOAPFault#setFaultString
 167      * @since SAAJ 1.2
 168      */
 169     public SOAPFault addFault(Name faultCode, String faultString)
 170         throws SOAPException;
 171 
 172     /**
 173      * Creates a new <code>SOAPFault</code> object and adds it to this <code>SOAPBody</code>
 174      * object. The type of the <code>SOAPFault</code>
 175      * will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code> depending on
 176      * the <code>protocol</code> specified while creating the <code>MessageFactory</code>
 177      * instance.
 178      * <p>
 179      * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
 180      * <i>Fault/Code/Value</i> element  and the <code>faultString</code> parameter
 181      * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
 182      * the <code>faultCode</code> parameter is the value of the <i>faultcode</i>
 183      * element and the <code>faultString</code> parameter is the value of the <i>faultstring</i>
 184      * element.
 185      * <p>
 186      * In case of a SOAP 1.2 fault, the default value for the mandatory <code>xml:lang</code>
 187      * attribute on the <i>Fault/Reason/Text</i> element will be set to
 188      * <code>java.util.Locale.getDefault()</code>
 189      * <p>
 190      * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
 191      * child element
 192      *
 193      * @param faultCode
 194      *            a <code>QName</code> object giving the fault code to be
 195      *            set; must be one of the fault codes defined in the version
 196      *            of  SOAP specification in use
 197      * @param faultString
 198      *            a <code>String</code> giving an explanation of the fault
 199      * @return the new <code>SOAPFault</code> object
 200      * @exception SOAPException
 201      *                if there is a SOAP error
 202      * @see SOAPFault#setFaultCode
 203      * @see SOAPFault#setFaultString
 204      * @see SOAPBody#addFault(Name faultCode, String faultString)
 205      * @since SAAJ 1.3
 206      */
 207     public SOAPFault addFault(QName faultCode, String faultString)
 208         throws SOAPException;
 209 
 210     /**
 211      * Indicates whether a <code>SOAPFault</code> object exists in this
 212      * <code>SOAPBody</code> object.
 213      *
 214      * @return <code>true</code> if a <code>SOAPFault</code> object exists
 215      *         in this <code>SOAPBody</code> object; <code>false</code>
 216      *         otherwise
 217      */
 218     public boolean hasFault();
 219 
 220     /**
 221      * Returns the <code>SOAPFault</code> object in this <code>SOAPBody</code>
 222      * object.
 223      *
 224      * @return the <code>SOAPFault</code> object in this <code>SOAPBody</code>
 225      *         object if present, null otherwise.


 235      *            object
 236      * @return the new <code>SOAPBodyElement</code> object
 237      * @exception SOAPException
 238      *                if a SOAP error occurs
 239      * @see SOAPBody#addBodyElement(javax.xml.namespace.QName)
 240      */
 241     public SOAPBodyElement addBodyElement(Name name) throws SOAPException;
 242 
 243 
 244     /**
 245      * Creates a new <code>SOAPBodyElement</code> object with the specified
 246      * QName and adds it to this <code>SOAPBody</code> object.
 247      *
 248      * @param qname
 249      *            a <code>QName</code> object with the qname for the new
 250      *            <code>SOAPBodyElement</code> object
 251      * @return the new <code>SOAPBodyElement</code> object
 252      * @exception SOAPException
 253      *                if a SOAP error occurs
 254      * @see SOAPBody#addBodyElement(Name)
 255      * @since SAAJ 1.3
 256      */
 257     public SOAPBodyElement addBodyElement(QName qname) throws SOAPException;
 258 
 259     /**
 260      * Adds the root node of the DOM <code>{@link org.w3c.dom.Document}</code>
 261      * to this <code>SOAPBody</code> object.
 262      * <p>
 263      * Calling this method invalidates the <code>document</code> parameter.
 264      * The client application should discard all references to this <code>Document</code>
 265      * and its contents upon calling <code>addDocument</code>. The behavior
 266      * of an application that continues to use such references is undefined.
 267      *
 268      * @param document
 269      *            the <code>Document</code> object whose root node will be
 270      *            added to this <code>SOAPBody</code>.
 271      * @return the <code>SOAPBodyElement</code> that represents the root node
 272      *         that was added.
 273      * @exception SOAPException
 274      *                if the <code>Document</code> cannot be added
 275      * @since SAAJ 1.2
 276      */
 277     public SOAPBodyElement addDocument(org.w3c.dom.Document document)
 278         throws SOAPException;
 279 
 280     /**
 281      * Creates a new DOM <code>{@link org.w3c.dom.Document}</code> and sets
 282      * the first child of this <code>SOAPBody</code> as it's document
 283      * element. The child <code>SOAPElement</code> is removed as part of the
 284      * process.
 285      *
 286      * @return the <code>{@link org.w3c.dom.Document}</code> representation
 287      *         of the <code>SOAPBody</code> content.
 288      *
 289      * @exception SOAPException
 290      *                if there is not exactly one child <code>SOAPElement</code> of the <code>
 291      *              <code>SOAPBody</code>.
 292      *
 293      * @since SAAJ 1.3
 294      */
 295     public org.w3c.dom.Document extractContentAsDocument()
 296         throws SOAPException;
 297 }


  25 
  26 package javax.xml.soap;
  27 
  28 import java.util.Locale;
  29 
  30 import org.w3c.dom.Document;
  31 
  32 import javax.xml.namespace.QName;
  33 
  34 /**
  35  * An object that represents the contents of the SOAP body
  36  * element in a SOAP message. A SOAP body element consists of XML data
  37  * that affects the way the application-specific content is processed.
  38  * <P>
  39  * A <code>SOAPBody</code> object contains <code>SOAPBodyElement</code>
  40  * objects, which have the content for the SOAP body.
  41  * A <code>SOAPFault</code> object, which carries status and/or
  42  * error information, is an example of a <code>SOAPBodyElement</code> object.
  43  *
  44  * @see SOAPFault
  45  * @since 1.6
  46  */
  47 public interface SOAPBody extends SOAPElement {
  48 
  49     /**
  50      * Creates a new <code>SOAPFault</code> object and adds it to
  51      * this <code>SOAPBody</code> object. The new <code>SOAPFault</code> will
  52      * have default values set for the mandatory child elements. The type of
  53      * the <code>SOAPFault</code> will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code>
  54      * depending on the <code>protocol</code> specified while creating the
  55      * <code>MessageFactory</code> instance.
  56      * <p>
  57      * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
  58      * child element.
  59      *
  60      * @return the new <code>SOAPFault</code> object
  61      * @exception SOAPException if there is a SOAP error
  62      */
  63     public SOAPFault addFault() throws SOAPException;
  64 
  65 


  74      * <i>Fault/Code/Value</i> element  and the <code>faultString</code> parameter
  75      * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
  76      * the <code>faultCode</code> parameter is the value of the <code>faultcode</code>
  77      * element and the <code>faultString</code> parameter is the value of the <code>faultstring</code>
  78      * element.
  79      * <p>
  80      * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
  81      * child element.
  82      *
  83      * @param faultCode a <code>Name</code> object giving the fault
  84      *         code to be set; must be one of the fault codes defined in the Version
  85      *         of SOAP specification in use
  86      * @param faultString a <code>String</code> giving an explanation of
  87      *         the fault
  88      * @param locale a {@link java.util.Locale} object indicating
  89      *         the native language of the <code>faultString</code>
  90      * @return the new <code>SOAPFault</code> object
  91      * @exception SOAPException if there is a SOAP error
  92      * @see SOAPFault#setFaultCode
  93      * @see SOAPFault#setFaultString
  94      * @since 1.6, SAAJ 1.2
  95      */
  96     public SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws SOAPException;
  97 
  98     /**
  99      * Creates a new <code>SOAPFault</code> object and adds it to this
 100      * <code>SOAPBody</code> object. The type of the <code>SOAPFault</code>
 101      * will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code> depending on
 102      * the <code>protocol</code> specified while creating the <code>MessageFactory</code>
 103      * instance.
 104      * <p>
 105      * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
 106      * <i>Fault/Code/Value</i> element  and the <code>faultString</code> parameter
 107      * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
 108      * the <code>faultCode</code> parameter is the value of the <code>faultcode</code>
 109      * element and the <code>faultString</code> parameter is the value of the <code>faultstring</code>
 110      * element.
 111      * <p>
 112      * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
 113      * child element.
 114      *
 115      * @param faultCode
 116      *            a <code>QName</code> object giving the fault code to be
 117      *            set; must be one of the fault codes defined in the version
 118      *            of SOAP specification in use.
 119      * @param faultString
 120      *            a <code>String</code> giving an explanation of the fault
 121      * @param locale
 122      *            a {@link java.util.Locale Locale} object indicating the
 123      *            native language of the <code>faultString</code>
 124      * @return the new <code>SOAPFault</code> object
 125      * @exception SOAPException
 126      *                if there is a SOAP error
 127      * @see SOAPFault#setFaultCode
 128      * @see SOAPFault#setFaultString
 129      * @see SOAPBody#addFault(Name faultCode, String faultString, Locale locale)
 130      *
 131      * @since 1.6, SAAJ 1.3
 132      */
 133     public SOAPFault addFault(QName faultCode, String faultString, Locale locale)
 134         throws SOAPException;
 135 
 136     /**
 137      * Creates a new  <code>SOAPFault</code> object and adds it to this
 138      * <code>SOAPBody</code> object. The type of the <code>SOAPFault</code>
 139      * will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code> depending on
 140      * the <code>protocol</code> specified while creating the <code>MessageFactory</code>
 141      * instance.
 142      * <p>
 143      * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
 144      * <i>Fault/Code/Value</i> element  and the <code>faultString</code> parameter
 145      * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
 146      * the <code>faultCode</code> parameter is the value of the <i>faultcode</i>
 147      * element and the <code>faultString</code> parameter is the value of the <i>faultstring</i>
 148      * element.
 149      * <p>
 150      * In case of a SOAP 1.2 fault, the default value for the mandatory <code>xml:lang</code>
 151      * attribute on the <i>Fault/Reason/Text</i> element will be set to
 152      * <code>java.util.Locale.getDefault()</code>
 153      * <p>
 154      * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
 155      * child element.
 156      *
 157      * @param faultCode
 158      *            a <code>Name</code> object giving the fault code to be set;
 159      *            must be one of the fault codes defined in the version of SOAP
 160      *            specification in use
 161      * @param faultString
 162      *            a <code>String</code> giving an explanation of the fault
 163      * @return the new <code>SOAPFault</code> object
 164      * @exception SOAPException
 165      *                if there is a SOAP error
 166      * @see SOAPFault#setFaultCode
 167      * @see SOAPFault#setFaultString
 168      * @since 1.6, SAAJ 1.2
 169      */
 170     public SOAPFault addFault(Name faultCode, String faultString)
 171         throws SOAPException;
 172 
 173     /**
 174      * Creates a new <code>SOAPFault</code> object and adds it to this <code>SOAPBody</code>
 175      * object. The type of the <code>SOAPFault</code>
 176      * will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code> depending on
 177      * the <code>protocol</code> specified while creating the <code>MessageFactory</code>
 178      * instance.
 179      * <p>
 180      * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
 181      * <i>Fault/Code/Value</i> element  and the <code>faultString</code> parameter
 182      * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
 183      * the <code>faultCode</code> parameter is the value of the <i>faultcode</i>
 184      * element and the <code>faultString</code> parameter is the value of the <i>faultstring</i>
 185      * element.
 186      * <p>
 187      * In case of a SOAP 1.2 fault, the default value for the mandatory <code>xml:lang</code>
 188      * attribute on the <i>Fault/Reason/Text</i> element will be set to
 189      * <code>java.util.Locale.getDefault()</code>
 190      * <p>
 191      * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
 192      * child element
 193      *
 194      * @param faultCode
 195      *            a <code>QName</code> object giving the fault code to be
 196      *            set; must be one of the fault codes defined in the version
 197      *            of  SOAP specification in use
 198      * @param faultString
 199      *            a <code>String</code> giving an explanation of the fault
 200      * @return the new <code>SOAPFault</code> object
 201      * @exception SOAPException
 202      *                if there is a SOAP error
 203      * @see SOAPFault#setFaultCode
 204      * @see SOAPFault#setFaultString
 205      * @see SOAPBody#addFault(Name faultCode, String faultString)
 206      * @since 1.6, SAAJ 1.3
 207      */
 208     public SOAPFault addFault(QName faultCode, String faultString)
 209         throws SOAPException;
 210 
 211     /**
 212      * Indicates whether a <code>SOAPFault</code> object exists in this
 213      * <code>SOAPBody</code> object.
 214      *
 215      * @return <code>true</code> if a <code>SOAPFault</code> object exists
 216      *         in this <code>SOAPBody</code> object; <code>false</code>
 217      *         otherwise
 218      */
 219     public boolean hasFault();
 220 
 221     /**
 222      * Returns the <code>SOAPFault</code> object in this <code>SOAPBody</code>
 223      * object.
 224      *
 225      * @return the <code>SOAPFault</code> object in this <code>SOAPBody</code>
 226      *         object if present, null otherwise.


 236      *            object
 237      * @return the new <code>SOAPBodyElement</code> object
 238      * @exception SOAPException
 239      *                if a SOAP error occurs
 240      * @see SOAPBody#addBodyElement(javax.xml.namespace.QName)
 241      */
 242     public SOAPBodyElement addBodyElement(Name name) throws SOAPException;
 243 
 244 
 245     /**
 246      * Creates a new <code>SOAPBodyElement</code> object with the specified
 247      * QName and adds it to this <code>SOAPBody</code> object.
 248      *
 249      * @param qname
 250      *            a <code>QName</code> object with the qname for the new
 251      *            <code>SOAPBodyElement</code> object
 252      * @return the new <code>SOAPBodyElement</code> object
 253      * @exception SOAPException
 254      *                if a SOAP error occurs
 255      * @see SOAPBody#addBodyElement(Name)
 256      * @since 1.6, SAAJ 1.3
 257      */
 258     public SOAPBodyElement addBodyElement(QName qname) throws SOAPException;
 259 
 260     /**
 261      * Adds the root node of the DOM <code>{@link org.w3c.dom.Document}</code>
 262      * to this <code>SOAPBody</code> object.
 263      * <p>
 264      * Calling this method invalidates the <code>document</code> parameter.
 265      * The client application should discard all references to this <code>Document</code>
 266      * and its contents upon calling <code>addDocument</code>. The behavior
 267      * of an application that continues to use such references is undefined.
 268      *
 269      * @param document
 270      *            the <code>Document</code> object whose root node will be
 271      *            added to this <code>SOAPBody</code>.
 272      * @return the <code>SOAPBodyElement</code> that represents the root node
 273      *         that was added.
 274      * @exception SOAPException
 275      *                if the <code>Document</code> cannot be added
 276      * @since 1.6, SAAJ 1.2
 277      */
 278     public SOAPBodyElement addDocument(org.w3c.dom.Document document)
 279         throws SOAPException;
 280 
 281     /**
 282      * Creates a new DOM <code>{@link org.w3c.dom.Document}</code> and sets
 283      * the first child of this <code>SOAPBody</code> as it's document
 284      * element. The child <code>SOAPElement</code> is removed as part of the
 285      * process.
 286      *
 287      * @return the <code>{@link org.w3c.dom.Document}</code> representation
 288      *         of the <code>SOAPBody</code> content.
 289      *
 290      * @exception SOAPException
 291      *                if there is not exactly one child <code>SOAPElement</code> of the <code>
 292      *              <code>SOAPBody</code>.
 293      *
 294      * @since 1.6, SAAJ 1.3
 295      */
 296     public org.w3c.dom.Document extractContentAsDocument()
 297         throws SOAPException;
 298 }