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

Fri, 04 Oct 2013 16:21:34 +0100

author
mkos
date
Fri, 04 Oct 2013 16:21:34 +0100
changeset 408
b0610cd08440
parent 368
0989ad8c0860
child 637
9c07ef4934dd
permissions
-rw-r--r--

8025054: Update JAX-WS RI integration to 2.2.9-b130926.1035
Reviewed-by: chegar

ohair@286 1 /*
alanb@368 2 * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
ohair@286 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ohair@286 4 *
ohair@286 5 * This code is free software; you can redistribute it and/or modify it
ohair@286 6 * under the terms of the GNU General Public License version 2 only, as
ohair@286 7 * published by the Free Software Foundation. Oracle designates this
ohair@286 8 * particular file as subject to the "Classpath" exception as provided
ohair@286 9 * by Oracle in the LICENSE file that accompanied this code.
ohair@286 10 *
ohair@286 11 * This code is distributed in the hope that it will be useful, but WITHOUT
ohair@286 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ohair@286 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ohair@286 14 * version 2 for more details (a copy is included in the LICENSE file that
ohair@286 15 * accompanied this code).
ohair@286 16 *
ohair@286 17 * You should have received a copy of the GNU General Public License version
ohair@286 18 * 2 along with this work; if not, write to the Free Software Foundation,
ohair@286 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ohair@286 20 *
ohair@286 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@286 22 * or visit www.oracle.com if you need additional information or have any
ohair@286 23 * questions.
ohair@286 24 */
ohair@286 25
ohair@286 26 package javax.xml.soap;
ohair@286 27
ohair@286 28 import java.util.Locale;
ohair@286 29
ohair@286 30 import org.w3c.dom.Document;
ohair@286 31
ohair@286 32 import javax.xml.namespace.QName;
ohair@286 33
ohair@286 34 /**
ohair@286 35 * An object that represents the contents of the SOAP body
ohair@286 36 * element in a SOAP message. A SOAP body element consists of XML data
ohair@286 37 * that affects the way the application-specific content is processed.
ohair@286 38 * <P>
ohair@286 39 * A <code>SOAPBody</code> object contains <code>SOAPBodyElement</code>
ohair@286 40 * objects, which have the content for the SOAP body.
ohair@286 41 * A <code>SOAPFault</code> object, which carries status and/or
ohair@286 42 * error information, is an example of a <code>SOAPBodyElement</code> object.
ohair@286 43 *
ohair@286 44 * @see SOAPFault
ohair@286 45 */
ohair@286 46 public interface SOAPBody extends SOAPElement {
ohair@286 47
ohair@286 48 /**
ohair@286 49 * Creates a new <code>SOAPFault</code> object and adds it to
ohair@286 50 * this <code>SOAPBody</code> object. The new <code>SOAPFault</code> will
ohair@286 51 * have default values set for the mandatory child elements. The type of
ohair@286 52 * the <code>SOAPFault</code> will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code>
ohair@286 53 * depending on the <code>protocol</code> specified while creating the
ohair@286 54 * <code>MessageFactory</code> instance.
ohair@286 55 * <p>
ohair@286 56 * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
ohair@286 57 * child element.
ohair@286 58 *
ohair@286 59 * @return the new <code>SOAPFault</code> object
ohair@286 60 * @exception SOAPException if there is a SOAP error
ohair@286 61 */
ohair@286 62 public SOAPFault addFault() throws SOAPException;
ohair@286 63
ohair@286 64
ohair@286 65 /**
ohair@286 66 * Creates a new <code>SOAPFault</code> object and adds it to
ohair@286 67 * this <code>SOAPBody</code> object. The type of the
ohair@286 68 * <code>SOAPFault</code> will be a SOAP 1.1 or a SOAP 1.2
ohair@286 69 * <code>SOAPFault</code> depending on the <code>protocol</code>
ohair@286 70 * specified while creating the <code>MessageFactory</code> instance.
ohair@286 71 * <p>
ohair@286 72 * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
ohair@286 73 * <i>Fault/Code/Value</i> element and the <code>faultString</code> parameter
ohair@286 74 * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
ohair@286 75 * the <code>faultCode</code> parameter is the value of the <code>faultcode</code>
ohair@286 76 * element and the <code>faultString</code> parameter is the value of the <code>faultstring</code>
ohair@286 77 * element.
ohair@286 78 * <p>
ohair@286 79 * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
ohair@286 80 * child element.
ohair@286 81 *
ohair@286 82 * @param faultCode a <code>Name</code> object giving the fault
ohair@286 83 * code to be set; must be one of the fault codes defined in the Version
ohair@286 84 * of SOAP specification in use
ohair@286 85 * @param faultString a <code>String</code> giving an explanation of
ohair@286 86 * the fault
ohair@286 87 * @param locale a {@link java.util.Locale} object indicating
ohair@286 88 * the native language of the <code>faultString</code>
ohair@286 89 * @return the new <code>SOAPFault</code> object
ohair@286 90 * @exception SOAPException if there is a SOAP error
ohair@286 91 * @see SOAPFault#setFaultCode
ohair@286 92 * @see SOAPFault#setFaultString
ohair@286 93 * @since SAAJ 1.2
ohair@286 94 */
ohair@286 95 public SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws SOAPException;
ohair@286 96
ohair@286 97 /**
ohair@286 98 * Creates a new <code>SOAPFault</code> object and adds it to this
ohair@286 99 * <code>SOAPBody</code> object. The type of the <code>SOAPFault</code>
ohair@286 100 * will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code> depending on
ohair@286 101 * the <code>protocol</code> specified while creating the <code>MessageFactory</code>
ohair@286 102 * instance.
ohair@286 103 * <p>
ohair@286 104 * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
ohair@286 105 * <i>Fault/Code/Value</i> element and the <code>faultString</code> parameter
ohair@286 106 * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
ohair@286 107 * the <code>faultCode</code> parameter is the value of the <code>faultcode</code>
ohair@286 108 * element and the <code>faultString</code> parameter is the value of the <code>faultstring</code>
ohair@286 109 * element.
ohair@286 110 * <p>
ohair@286 111 * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
ohair@286 112 * child element.
ohair@286 113 *
ohair@286 114 * @param faultCode
ohair@286 115 * a <code>QName</code> object giving the fault code to be
ohair@286 116 * set; must be one of the fault codes defined in the version
ohair@286 117 * of SOAP specification in use.
ohair@286 118 * @param faultString
ohair@286 119 * a <code>String</code> giving an explanation of the fault
ohair@286 120 * @param locale
ohair@286 121 * a {@link java.util.Locale Locale} object indicating the
ohair@286 122 * native language of the <code>faultString</code>
ohair@286 123 * @return the new <code>SOAPFault</code> object
ohair@286 124 * @exception SOAPException
ohair@286 125 * if there is a SOAP error
ohair@286 126 * @see SOAPFault#setFaultCode
ohair@286 127 * @see SOAPFault#setFaultString
ohair@286 128 * @see SOAPBody#addFault(Name faultCode, String faultString, Locale locale)
ohair@286 129 *
ohair@286 130 * @since SAAJ 1.3
ohair@286 131 */
ohair@286 132 public SOAPFault addFault(QName faultCode, String faultString, Locale locale)
ohair@286 133 throws SOAPException;
ohair@286 134
ohair@286 135 /**
ohair@286 136 * Creates a new <code>SOAPFault</code> object and adds it to this
ohair@286 137 * <code>SOAPBody</code> object. The type of the <code>SOAPFault</code>
ohair@286 138 * will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code> depending on
ohair@286 139 * the <code>protocol</code> specified while creating the <code>MessageFactory</code>
ohair@286 140 * instance.
ohair@286 141 * <p>
ohair@286 142 * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
ohair@286 143 * <i>Fault/Code/Value</i> element and the <code>faultString</code> parameter
ohair@286 144 * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
ohair@286 145 * the <code>faultCode</code> parameter is the value of the <i>faultcode</i>
ohair@286 146 * element and the <code>faultString</code> parameter is the value of the <i>faultstring</i>
ohair@286 147 * element.
ohair@286 148 * <p>
ohair@286 149 * In case of a SOAP 1.2 fault, the default value for the mandatory <code>xml:lang</code>
ohair@286 150 * attribute on the <i>Fault/Reason/Text</i> element will be set to
ohair@286 151 * <code>java.util.Locale.getDefault()</code>
ohair@286 152 * <p>
ohair@286 153 * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
ohair@286 154 * child element.
ohair@286 155 *
ohair@286 156 * @param faultCode
ohair@286 157 * a <code>Name</code> object giving the fault code to be set;
ohair@286 158 * must be one of the fault codes defined in the version of SOAP
ohair@286 159 * specification in use
ohair@286 160 * @param faultString
ohair@286 161 * a <code>String</code> giving an explanation of the fault
ohair@286 162 * @return the new <code>SOAPFault</code> object
ohair@286 163 * @exception SOAPException
ohair@286 164 * if there is a SOAP error
ohair@286 165 * @see SOAPFault#setFaultCode
ohair@286 166 * @see SOAPFault#setFaultString
ohair@286 167 * @since SAAJ 1.2
ohair@286 168 */
ohair@286 169 public SOAPFault addFault(Name faultCode, String faultString)
ohair@286 170 throws SOAPException;
ohair@286 171
ohair@286 172 /**
ohair@286 173 * Creates a new <code>SOAPFault</code> object and adds it to this <code>SOAPBody</code>
ohair@286 174 * object. The type of the <code>SOAPFault</code>
ohair@286 175 * will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code> depending on
ohair@286 176 * the <code>protocol</code> specified while creating the <code>MessageFactory</code>
ohair@286 177 * instance.
ohair@286 178 * <p>
ohair@286 179 * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
ohair@286 180 * <i>Fault/Code/Value</i> element and the <code>faultString</code> parameter
ohair@286 181 * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
ohair@286 182 * the <code>faultCode</code> parameter is the value of the <i>faultcode</i>
ohair@286 183 * element and the <code>faultString</code> parameter is the value of the <i>faultstring</i>
ohair@286 184 * element.
ohair@286 185 * <p>
ohair@286 186 * In case of a SOAP 1.2 fault, the default value for the mandatory <code>xml:lang</code>
ohair@286 187 * attribute on the <i>Fault/Reason/Text</i> element will be set to
ohair@286 188 * <code>java.util.Locale.getDefault()</code>
ohair@286 189 * <p>
ohair@286 190 * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
ohair@286 191 * child element
ohair@286 192 *
ohair@286 193 * @param faultCode
ohair@286 194 * a <code>QName</code> object giving the fault code to be
ohair@286 195 * set; must be one of the fault codes defined in the version
ohair@286 196 * of SOAP specification in use
ohair@286 197 * @param faultString
ohair@286 198 * a <code>String</code> giving an explanation of the fault
ohair@286 199 * @return the new <code>SOAPFault</code> object
ohair@286 200 * @exception SOAPException
ohair@286 201 * if there is a SOAP error
ohair@286 202 * @see SOAPFault#setFaultCode
ohair@286 203 * @see SOAPFault#setFaultString
ohair@286 204 * @see SOAPBody#addFault(Name faultCode, String faultString)
ohair@286 205 * @since SAAJ 1.3
ohair@286 206 */
ohair@286 207 public SOAPFault addFault(QName faultCode, String faultString)
ohair@286 208 throws SOAPException;
ohair@286 209
ohair@286 210 /**
ohair@286 211 * Indicates whether a <code>SOAPFault</code> object exists in this
ohair@286 212 * <code>SOAPBody</code> object.
ohair@286 213 *
ohair@286 214 * @return <code>true</code> if a <code>SOAPFault</code> object exists
ohair@286 215 * in this <code>SOAPBody</code> object; <code>false</code>
ohair@286 216 * otherwise
ohair@286 217 */
ohair@286 218 public boolean hasFault();
ohair@286 219
ohair@286 220 /**
ohair@286 221 * Returns the <code>SOAPFault</code> object in this <code>SOAPBody</code>
ohair@286 222 * object.
ohair@286 223 *
ohair@286 224 * @return the <code>SOAPFault</code> object in this <code>SOAPBody</code>
ohair@286 225 * object if present, null otherwise.
ohair@286 226 */
ohair@286 227 public SOAPFault getFault();
ohair@286 228
ohair@286 229 /**
ohair@286 230 * Creates a new <code>SOAPBodyElement</code> object with the specified
ohair@286 231 * name and adds it to this <code>SOAPBody</code> object.
ohair@286 232 *
ohair@286 233 * @param name
ohair@286 234 * a <code>Name</code> object with the name for the new <code>SOAPBodyElement</code>
ohair@286 235 * object
ohair@286 236 * @return the new <code>SOAPBodyElement</code> object
ohair@286 237 * @exception SOAPException
ohair@286 238 * if a SOAP error occurs
ohair@286 239 * @see SOAPBody#addBodyElement(javax.xml.namespace.QName)
ohair@286 240 */
ohair@286 241 public SOAPBodyElement addBodyElement(Name name) throws SOAPException;
ohair@286 242
ohair@286 243
ohair@286 244 /**
ohair@286 245 * Creates a new <code>SOAPBodyElement</code> object with the specified
ohair@286 246 * QName and adds it to this <code>SOAPBody</code> object.
ohair@286 247 *
ohair@286 248 * @param qname
ohair@286 249 * a <code>QName</code> object with the qname for the new
ohair@286 250 * <code>SOAPBodyElement</code> object
ohair@286 251 * @return the new <code>SOAPBodyElement</code> object
ohair@286 252 * @exception SOAPException
ohair@286 253 * if a SOAP error occurs
ohair@286 254 * @see SOAPBody#addBodyElement(Name)
ohair@286 255 * @since SAAJ 1.3
ohair@286 256 */
ohair@286 257 public SOAPBodyElement addBodyElement(QName qname) throws SOAPException;
ohair@286 258
ohair@286 259 /**
ohair@286 260 * Adds the root node of the DOM <code>{@link org.w3c.dom.Document}</code>
ohair@286 261 * to this <code>SOAPBody</code> object.
ohair@286 262 * <p>
ohair@286 263 * Calling this method invalidates the <code>document</code> parameter.
ohair@286 264 * The client application should discard all references to this <code>Document</code>
ohair@286 265 * and its contents upon calling <code>addDocument</code>. The behavior
ohair@286 266 * of an application that continues to use such references is undefined.
ohair@286 267 *
ohair@286 268 * @param document
ohair@286 269 * the <code>Document</code> object whose root node will be
ohair@286 270 * added to this <code>SOAPBody</code>.
ohair@286 271 * @return the <code>SOAPBodyElement</code> that represents the root node
ohair@286 272 * that was added.
ohair@286 273 * @exception SOAPException
ohair@286 274 * if the <code>Document</code> cannot be added
ohair@286 275 * @since SAAJ 1.2
ohair@286 276 */
ohair@286 277 public SOAPBodyElement addDocument(org.w3c.dom.Document document)
ohair@286 278 throws SOAPException;
ohair@286 279
ohair@286 280 /**
ohair@286 281 * Creates a new DOM <code>{@link org.w3c.dom.Document}</code> and sets
ohair@286 282 * the first child of this <code>SOAPBody</code> as it's document
ohair@286 283 * element. The child <code>SOAPElement</code> is removed as part of the
ohair@286 284 * process.
ohair@286 285 *
ohair@286 286 * @return the <code>{@link org.w3c.dom.Document}</code> representation
ohair@286 287 * of the <code>SOAPBody</code> content.
ohair@286 288 *
ohair@286 289 * @exception SOAPException
ohair@286 290 * if there is not exactly one child <code>SOAPElement</code> of the <code>
ohair@286 291 * <code>SOAPBody</code>.
ohair@286 292 *
ohair@286 293 * @since SAAJ 1.3
ohair@286 294 */
ohair@286 295 public org.w3c.dom.Document extractContentAsDocument()
ohair@286 296 throws SOAPException;
ohair@286 297 }

mercurial