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

changeset 286
f50545b5e2f1
child 368
0989ad8c0860
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/jaxws_classes/javax/xml/soap/SOAPBody.java	Tue Mar 06 16:09:35 2012 -0800
     1.3 @@ -0,0 +1,297 @@
     1.4 +/*
     1.5 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Oracle designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Oracle in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 + * or visit www.oracle.com if you need additional information or have any
    1.26 + * questions.
    1.27 + */
    1.28 +
    1.29 +package javax.xml.soap;
    1.30 +
    1.31 +import java.util.Locale;
    1.32 +
    1.33 +import org.w3c.dom.Document;
    1.34 +
    1.35 +import javax.xml.namespace.QName;
    1.36 +
    1.37 +/**
    1.38 + * An object that represents the contents of the SOAP body
    1.39 + * element in a SOAP message. A SOAP body element consists of XML data
    1.40 + * that affects the way the application-specific content is processed.
    1.41 + * <P>
    1.42 + * A <code>SOAPBody</code> object contains <code>SOAPBodyElement</code>
    1.43 + * objects, which have the content for the SOAP body.
    1.44 + * A <code>SOAPFault</code> object, which carries status and/or
    1.45 + * error information, is an example of a <code>SOAPBodyElement</code> object.
    1.46 + *
    1.47 + * @see SOAPFault
    1.48 + */
    1.49 +public interface SOAPBody extends SOAPElement {
    1.50 +
    1.51 +    /**
    1.52 +     * Creates a new <code>SOAPFault</code> object and adds it to
    1.53 +     * this <code>SOAPBody</code> object. The new <code>SOAPFault</code> will
    1.54 +     * have default values set for the mandatory child elements. The type of
    1.55 +     * the <code>SOAPFault</code> will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code>
    1.56 +     * depending on the <code>protocol</code> specified while creating the
    1.57 +     * <code>MessageFactory</code> instance.
    1.58 +     * <p>
    1.59 +     * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
    1.60 +     * child element.
    1.61 +     *
    1.62 +     * @return the new <code>SOAPFault</code> object
    1.63 +     * @exception SOAPException if there is a SOAP error
    1.64 +     */
    1.65 +    public SOAPFault addFault() throws SOAPException;
    1.66 +
    1.67 +
    1.68 +    /**
    1.69 +     * Creates a new <code>SOAPFault</code> object and adds it to
    1.70 +     * this <code>SOAPBody</code> object. The type of the
    1.71 +     * <code>SOAPFault</code> will be a SOAP 1.1  or a SOAP 1.2
    1.72 +     * <code>SOAPFault</code> depending on the <code>protocol</code>
    1.73 +     * specified while creating the <code>MessageFactory</code> instance.
    1.74 +     * <p>
    1.75 +     * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
    1.76 +     * <i>Fault/Code/Value</i> element  and the <code>faultString</code> parameter
    1.77 +     * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
    1.78 +     * the <code>faultCode</code> parameter is the value of the <code>faultcode</code>
    1.79 +     * element and the <code>faultString</code> parameter is the value of the <code>faultstring</code>
    1.80 +     * element.
    1.81 +     * <p>
    1.82 +     * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
    1.83 +     * child element.
    1.84 +     *
    1.85 +     * @param faultCode a <code>Name</code> object giving the fault
    1.86 +     *         code to be set; must be one of the fault codes defined in the Version
    1.87 +     *         of SOAP specification in use
    1.88 +     * @param faultString a <code>String</code> giving an explanation of
    1.89 +     *         the fault
    1.90 +     * @param locale a {@link java.util.Locale} object indicating
    1.91 +     *         the native language of the <code>faultString</code>
    1.92 +     * @return the new <code>SOAPFault</code> object
    1.93 +     * @exception SOAPException if there is a SOAP error
    1.94 +     * @see SOAPFault#setFaultCode
    1.95 +     * @see SOAPFault#setFaultString
    1.96 +     * @since SAAJ 1.2
    1.97 +     */
    1.98 +    public SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws SOAPException;
    1.99 +
   1.100 +    /**
   1.101 +     * Creates a new <code>SOAPFault</code> object and adds it to this
   1.102 +     * <code>SOAPBody</code> object. The type of the <code>SOAPFault</code>
   1.103 +     * will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code> depending on
   1.104 +     * the <code>protocol</code> specified while creating the <code>MessageFactory</code>
   1.105 +     * instance.
   1.106 +     * <p>
   1.107 +     * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
   1.108 +     * <i>Fault/Code/Value</i> element  and the <code>faultString</code> parameter
   1.109 +     * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
   1.110 +     * the <code>faultCode</code> parameter is the value of the <code>faultcode</code>
   1.111 +     * element and the <code>faultString</code> parameter is the value of the <code>faultstring</code>
   1.112 +     * element.
   1.113 +     * <p>
   1.114 +     * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
   1.115 +     * child element.
   1.116 +     *
   1.117 +     * @param faultCode
   1.118 +     *            a <code>QName</code> object giving the fault code to be
   1.119 +     *            set; must be one of the fault codes defined in the version
   1.120 +     *            of SOAP specification in use.
   1.121 +     * @param faultString
   1.122 +     *            a <code>String</code> giving an explanation of the fault
   1.123 +     * @param locale
   1.124 +     *            a {@link java.util.Locale Locale} object indicating the
   1.125 +     *            native language of the <code>faultString</code>
   1.126 +     * @return the new <code>SOAPFault</code> object
   1.127 +     * @exception SOAPException
   1.128 +     *                if there is a SOAP error
   1.129 +     * @see SOAPFault#setFaultCode
   1.130 +     * @see SOAPFault#setFaultString
   1.131 +     * @see SOAPBody#addFault(Name faultCode, String faultString, Locale locale)
   1.132 +     *
   1.133 +     * @since SAAJ 1.3
   1.134 +     */
   1.135 +    public SOAPFault addFault(QName faultCode, String faultString, Locale locale)
   1.136 +        throws SOAPException;
   1.137 +
   1.138 +    /**
   1.139 +     * Creates a new  <code>SOAPFault</code> object and adds it to this
   1.140 +     * <code>SOAPBody</code> object. The type of the <code>SOAPFault</code>
   1.141 +     * will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code> depending on
   1.142 +     * the <code>protocol</code> specified while creating the <code>MessageFactory</code>
   1.143 +     * instance.
   1.144 +     * <p>
   1.145 +     * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
   1.146 +     * <i>Fault/Code/Value</i> element  and the <code>faultString</code> parameter
   1.147 +     * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
   1.148 +     * the <code>faultCode</code> parameter is the value of the <i>faultcode</i>
   1.149 +     * element and the <code>faultString</code> parameter is the value of the <i>faultstring</i>
   1.150 +     * element.
   1.151 +     * <p>
   1.152 +     * In case of a SOAP 1.2 fault, the default value for the mandatory <code>xml:lang</code>
   1.153 +     * attribute on the <i>Fault/Reason/Text</i> element will be set to
   1.154 +     * <code>java.util.Locale.getDefault()</code>
   1.155 +     * <p>
   1.156 +     * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
   1.157 +     * child element.
   1.158 +     *
   1.159 +     * @param faultCode
   1.160 +     *            a <code>Name</code> object giving the fault code to be set;
   1.161 +     *            must be one of the fault codes defined in the version of SOAP
   1.162 +     *            specification in use
   1.163 +     * @param faultString
   1.164 +     *            a <code>String</code> giving an explanation of the fault
   1.165 +     * @return the new <code>SOAPFault</code> object
   1.166 +     * @exception SOAPException
   1.167 +     *                if there is a SOAP error
   1.168 +     * @see SOAPFault#setFaultCode
   1.169 +     * @see SOAPFault#setFaultString
   1.170 +     * @since SAAJ 1.2
   1.171 +     */
   1.172 +    public SOAPFault addFault(Name faultCode, String faultString)
   1.173 +        throws SOAPException;
   1.174 +
   1.175 +    /**
   1.176 +     * Creates a new <code>SOAPFault</code> object and adds it to this <code>SOAPBody</code>
   1.177 +     * object. The type of the <code>SOAPFault</code>
   1.178 +     * will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code> depending on
   1.179 +     * the <code>protocol</code> specified while creating the <code>MessageFactory</code>
   1.180 +     * instance.
   1.181 +     * <p>
   1.182 +     * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
   1.183 +     * <i>Fault/Code/Value</i> element  and the <code>faultString</code> parameter
   1.184 +     * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
   1.185 +     * the <code>faultCode</code> parameter is the value of the <i>faultcode</i>
   1.186 +     * element and the <code>faultString</code> parameter is the value of the <i>faultstring</i>
   1.187 +     * element.
   1.188 +     * <p>
   1.189 +     * In case of a SOAP 1.2 fault, the default value for the mandatory <code>xml:lang</code>
   1.190 +     * attribute on the <i>Fault/Reason/Text</i> element will be set to
   1.191 +     * <code>java.util.Locale.getDefault()</code>
   1.192 +     * <p>
   1.193 +     * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
   1.194 +     * child element
   1.195 +     *
   1.196 +     * @param faultCode
   1.197 +     *            a <code>QName</code> object giving the fault code to be
   1.198 +     *            set; must be one of the fault codes defined in the version
   1.199 +     *            of  SOAP specification in use
   1.200 +     * @param faultString
   1.201 +     *            a <code>String</code> giving an explanation of the fault
   1.202 +     * @return the new <code>SOAPFault</code> object
   1.203 +     * @exception SOAPException
   1.204 +     *                if there is a SOAP error
   1.205 +     * @see SOAPFault#setFaultCode
   1.206 +     * @see SOAPFault#setFaultString
   1.207 +     * @see SOAPBody#addFault(Name faultCode, String faultString)
   1.208 +     * @since SAAJ 1.3
   1.209 +     */
   1.210 +    public SOAPFault addFault(QName faultCode, String faultString)
   1.211 +        throws SOAPException;
   1.212 +
   1.213 +    /**
   1.214 +     * Indicates whether a <code>SOAPFault</code> object exists in this
   1.215 +     * <code>SOAPBody</code> object.
   1.216 +     *
   1.217 +     * @return <code>true</code> if a <code>SOAPFault</code> object exists
   1.218 +     *         in this <code>SOAPBody</code> object; <code>false</code>
   1.219 +     *         otherwise
   1.220 +     */
   1.221 +    public boolean hasFault();
   1.222 +
   1.223 +    /**
   1.224 +     * Returns the <code>SOAPFault</code> object in this <code>SOAPBody</code>
   1.225 +     * object.
   1.226 +     *
   1.227 +     * @return the <code>SOAPFault</code> object in this <code>SOAPBody</code>
   1.228 +     *         object if present, null otherwise.
   1.229 +     */
   1.230 +    public SOAPFault getFault();
   1.231 +
   1.232 +    /**
   1.233 +     * Creates a new <code>SOAPBodyElement</code> object with the specified
   1.234 +     * name and adds it to this <code>SOAPBody</code> object.
   1.235 +     *
   1.236 +     * @param name
   1.237 +     *            a <code>Name</code> object with the name for the new <code>SOAPBodyElement</code>
   1.238 +     *            object
   1.239 +     * @return the new <code>SOAPBodyElement</code> object
   1.240 +     * @exception SOAPException
   1.241 +     *                if a SOAP error occurs
   1.242 +     * @see SOAPBody#addBodyElement(javax.xml.namespace.QName)
   1.243 +     */
   1.244 +    public SOAPBodyElement addBodyElement(Name name) throws SOAPException;
   1.245 +
   1.246 +
   1.247 +    /**
   1.248 +     * Creates a new <code>SOAPBodyElement</code> object with the specified
   1.249 +     * QName and adds it to this <code>SOAPBody</code> object.
   1.250 +     *
   1.251 +     * @param qname
   1.252 +     *            a <code>QName</code> object with the qname for the new
   1.253 +     *            <code>SOAPBodyElement</code> object
   1.254 +     * @return the new <code>SOAPBodyElement</code> object
   1.255 +     * @exception SOAPException
   1.256 +     *                if a SOAP error occurs
   1.257 +     * @see SOAPBody#addBodyElement(Name)
   1.258 +     * @since SAAJ 1.3
   1.259 +     */
   1.260 +    public SOAPBodyElement addBodyElement(QName qname) throws SOAPException;
   1.261 +
   1.262 +    /**
   1.263 +     * Adds the root node of the DOM <code>{@link org.w3c.dom.Document}</code>
   1.264 +     * to this <code>SOAPBody</code> object.
   1.265 +     * <p>
   1.266 +     * Calling this method invalidates the <code>document</code> parameter.
   1.267 +     * The client application should discard all references to this <code>Document</code>
   1.268 +     * and its contents upon calling <code>addDocument</code>. The behavior
   1.269 +     * of an application that continues to use such references is undefined.
   1.270 +     *
   1.271 +     * @param document
   1.272 +     *            the <code>Document</code> object whose root node will be
   1.273 +     *            added to this <code>SOAPBody</code>.
   1.274 +     * @return the <code>SOAPBodyElement</code> that represents the root node
   1.275 +     *         that was added.
   1.276 +     * @exception SOAPException
   1.277 +     *                if the <code>Document</code> cannot be added
   1.278 +     * @since SAAJ 1.2
   1.279 +     */
   1.280 +    public SOAPBodyElement addDocument(org.w3c.dom.Document document)
   1.281 +        throws SOAPException;
   1.282 +
   1.283 +    /**
   1.284 +     * Creates a new DOM <code>{@link org.w3c.dom.Document}</code> and sets
   1.285 +     * the first child of this <code>SOAPBody</code> as it's document
   1.286 +     * element. The child <code>SOAPElement</code> is removed as part of the
   1.287 +     * process.
   1.288 +     *
   1.289 +     * @return the <code>{@link org.w3c.dom.Document}</code> representation
   1.290 +     *         of the <code>SOAPBody</code> content.
   1.291 +     *
   1.292 +     * @exception SOAPException
   1.293 +     *                if there is not exactly one child <code>SOAPElement</code> of the <code>
   1.294 +     *              <code>SOAPBody</code>.
   1.295 +     *
   1.296 +     * @since SAAJ 1.3
   1.297 +     */
   1.298 +    public org.w3c.dom.Document extractContentAsDocument()
   1.299 +        throws SOAPException;
   1.300 +}

mercurial