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