325N/A/*
325N/A * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
325N/A *
325N/A * This code is free software; you can redistribute it and/or modify it
325N/A * under the terms of the GNU General Public License version 2 only, as
325N/A * published by the Free Software Foundation. Oracle designates this
325N/A * particular file as subject to the "Classpath" exception as provided
325N/A * by Oracle in the LICENSE file that accompanied this code.
325N/A *
325N/A * This code is distributed in the hope that it will be useful, but WITHOUT
325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
325N/A * version 2 for more details (a copy is included in the LICENSE file that
325N/A * accompanied this code).
325N/A *
325N/A * You should have received a copy of the GNU General Public License version
325N/A * 2 along with this work; if not, write to the Free Software Foundation,
325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
325N/A *
325N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
325N/A * or visit www.oracle.com if you need additional information or have any
325N/A * questions.
325N/A */
325N/A
325N/Apackage javax.xml.soap;
325N/A
325N/Aimport java.util.Locale;
325N/A
325N/Aimport org.w3c.dom.Document;
325N/A
325N/Aimport javax.xml.namespace.QName;
325N/A
325N/A/**
325N/A * An object that represents the contents of the SOAP body
325N/A * element in a SOAP message. A SOAP body element consists of XML data
325N/A * that affects the way the application-specific content is processed.
325N/A * <P>
325N/A * A <code>SOAPBody</code> object contains <code>SOAPBodyElement</code>
325N/A * objects, which have the content for the SOAP body.
325N/A * A <code>SOAPFault</code> object, which carries status and/or
325N/A * error information, is an example of a <code>SOAPBodyElement</code> object.
325N/A *
325N/A * @see SOAPFault
325N/A */
325N/Apublic interface SOAPBody extends SOAPElement {
325N/A
325N/A /**
325N/A * Creates a new <code>SOAPFault</code> object and adds it to
325N/A * this <code>SOAPBody</code> object. The new <code>SOAPFault</code> will
325N/A * have default values set for the mandatory child elements. The type of
325N/A * the <code>SOAPFault</code> will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code>
325N/A * depending on the <code>protocol</code> specified while creating the
325N/A * <code>MessageFactory</code> instance.
325N/A * <p>
325N/A * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
325N/A * child element.
325N/A *
325N/A * @return the new <code>SOAPFault</code> object
325N/A * @exception SOAPException if there is a SOAP error
325N/A */
325N/A public SOAPFault addFault() throws SOAPException;
325N/A
325N/A
325N/A /**
325N/A * Creates a new <code>SOAPFault</code> object and adds it to
325N/A * this <code>SOAPBody</code> object. The type of the
325N/A * <code>SOAPFault</code> will be a SOAP 1.1 or a SOAP 1.2
325N/A * <code>SOAPFault</code> depending on the <code>protocol</code>
325N/A * specified while creating the <code>MessageFactory</code> instance.
325N/A * <p>
325N/A * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
325N/A * <i>Fault/Code/Value</i> element and the <code>faultString</code> parameter
325N/A * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
325N/A * the <code>faultCode</code> parameter is the value of the <code>faultcode</code>
325N/A * element and the <code>faultString</code> parameter is the value of the <code>faultstring</code>
325N/A * element.
325N/A * <p>
325N/A * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
325N/A * child element.
325N/A *
325N/A * @param faultCode a <code>Name</code> object giving the fault
325N/A * code to be set; must be one of the fault codes defined in the Version
325N/A * of SOAP specification in use
325N/A * @param faultString a <code>String</code> giving an explanation of
325N/A * the fault
325N/A * @param locale a {@link java.util.Locale} object indicating
325N/A * the native language of the <code>faultString</code>
325N/A * @return the new <code>SOAPFault</code> object
325N/A * @exception SOAPException if there is a SOAP error
325N/A * @see SOAPFault#setFaultCode
325N/A * @see SOAPFault#setFaultString
325N/A * @since SAAJ 1.2
325N/A */
325N/A public SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws SOAPException;
325N/A
325N/A /**
325N/A * Creates a new <code>SOAPFault</code> object and adds it to this
325N/A * <code>SOAPBody</code> object. The type of the <code>SOAPFault</code>
325N/A * will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code> depending on
325N/A * the <code>protocol</code> specified while creating the <code>MessageFactory</code>
325N/A * instance.
325N/A * <p>
325N/A * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
325N/A * <i>Fault/Code/Value</i> element and the <code>faultString</code> parameter
325N/A * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
325N/A * the <code>faultCode</code> parameter is the value of the <code>faultcode</code>
325N/A * element and the <code>faultString</code> parameter is the value of the <code>faultstring</code>
325N/A * element.
325N/A * <p>
325N/A * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
325N/A * child element.
325N/A *
325N/A * @param faultCode
325N/A * a <code>QName</code> object giving the fault code to be
325N/A * set; must be one of the fault codes defined in the version
325N/A * of SOAP specification in use.
325N/A * @param faultString
325N/A * a <code>String</code> giving an explanation of the fault
325N/A * @param locale
325N/A * a {@link java.util.Locale Locale} object indicating the
325N/A * native language of the <code>faultString</code>
325N/A * @return the new <code>SOAPFault</code> object
325N/A * @exception SOAPException
325N/A * if there is a SOAP error
325N/A * @see SOAPFault#setFaultCode
325N/A * @see SOAPFault#setFaultString
325N/A * @see SOAPBody#addFault(Name faultCode, String faultString, Locale locale)
325N/A *
325N/A * @since SAAJ 1.3
325N/A */
325N/A public SOAPFault addFault(QName faultCode, String faultString, Locale locale)
325N/A throws SOAPException;
325N/A
325N/A /**
325N/A * Creates a new <code>SOAPFault</code> object and adds it to this
325N/A * <code>SOAPBody</code> object. The type of the <code>SOAPFault</code>
325N/A * will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code> depending on
325N/A * the <code>protocol</code> specified while creating the <code>MessageFactory</code>
325N/A * instance.
325N/A * <p>
325N/A * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
325N/A * <i>Fault/Code/Value</i> element and the <code>faultString</code> parameter
325N/A * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
325N/A * the <code>faultCode</code> parameter is the value of the <i>faultcode</i>
325N/A * element and the <code>faultString</code> parameter is the value of the <i>faultstring</i>
325N/A * element.
325N/A * <p>
325N/A * In case of a SOAP 1.2 fault, the default value for the mandatory <code>xml:lang</code>
325N/A * attribute on the <i>Fault/Reason/Text</i> element will be set to
325N/A * <code>java.util.Locale.getDefault()</code>
325N/A * <p>
325N/A * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
325N/A * child element.
325N/A *
325N/A * @param faultCode
325N/A * a <code>Name</code> object giving the fault code to be set;
325N/A * must be one of the fault codes defined in the version of SOAP
325N/A * specification in use
325N/A * @param faultString
325N/A * a <code>String</code> giving an explanation of the fault
325N/A * @return the new <code>SOAPFault</code> object
325N/A * @exception SOAPException
325N/A * if there is a SOAP error
325N/A * @see SOAPFault#setFaultCode
325N/A * @see SOAPFault#setFaultString
325N/A * @since SAAJ 1.2
325N/A */
325N/A public SOAPFault addFault(Name faultCode, String faultString)
325N/A throws SOAPException;
325N/A
325N/A /**
325N/A * Creates a new <code>SOAPFault</code> object and adds it to this <code>SOAPBody</code>
325N/A * object. The type of the <code>SOAPFault</code>
325N/A * will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code> depending on
325N/A * the <code>protocol</code> specified while creating the <code>MessageFactory</code>
325N/A * instance.
325N/A * <p>
325N/A * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
325N/A * <i>Fault/Code/Value</i> element and the <code>faultString</code> parameter
325N/A * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
325N/A * the <code>faultCode</code> parameter is the value of the <i>faultcode</i>
325N/A * element and the <code>faultString</code> parameter is the value of the <i>faultstring</i>
325N/A * element.
325N/A * <p>
325N/A * In case of a SOAP 1.2 fault, the default value for the mandatory <code>xml:lang</code>
325N/A * attribute on the <i>Fault/Reason/Text</i> element will be set to
325N/A * <code>java.util.Locale.getDefault()</code>
325N/A * <p>
325N/A * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
325N/A * child element
325N/A *
325N/A * @param faultCode
325N/A * a <code>QName</code> object giving the fault code to be
325N/A * set; must be one of the fault codes defined in the version
325N/A * of SOAP specification in use
325N/A * @param faultString
325N/A * a <code>String</code> giving an explanation of the fault
325N/A * @return the new <code>SOAPFault</code> object
325N/A * @exception SOAPException
325N/A * if there is a SOAP error
325N/A * @see SOAPFault#setFaultCode
325N/A * @see SOAPFault#setFaultString
325N/A * @see SOAPBody#addFault(Name faultCode, String faultString)
325N/A * @since SAAJ 1.3
325N/A */
325N/A public SOAPFault addFault(QName faultCode, String faultString)
325N/A throws SOAPException;
325N/A
325N/A /**
325N/A * Indicates whether a <code>SOAPFault</code> object exists in this
325N/A * <code>SOAPBody</code> object.
325N/A *
325N/A * @return <code>true</code> if a <code>SOAPFault</code> object exists
325N/A * in this <code>SOAPBody</code> object; <code>false</code>
325N/A * otherwise
325N/A */
325N/A public boolean hasFault();
325N/A
325N/A /**
325N/A * Returns the <code>SOAPFault</code> object in this <code>SOAPBody</code>
325N/A * object.
325N/A *
325N/A * @return the <code>SOAPFault</code> object in this <code>SOAPBody</code>
325N/A * object if present, null otherwise.
325N/A */
325N/A public SOAPFault getFault();
325N/A
325N/A /**
325N/A * Creates a new <code>SOAPBodyElement</code> object with the specified
325N/A * name and adds it to this <code>SOAPBody</code> object.
325N/A *
325N/A * @param name
325N/A * a <code>Name</code> object with the name for the new <code>SOAPBodyElement</code>
325N/A * object
325N/A * @return the new <code>SOAPBodyElement</code> object
325N/A * @exception SOAPException
325N/A * if a SOAP error occurs
325N/A * @see SOAPBody#addBodyElement(javax.xml.namespace.QName)
325N/A */
325N/A public SOAPBodyElement addBodyElement(Name name) throws SOAPException;
325N/A
325N/A
325N/A /**
325N/A * Creates a new <code>SOAPBodyElement</code> object with the specified
325N/A * QName and adds it to this <code>SOAPBody</code> object.
325N/A *
325N/A * @param qname
325N/A * a <code>QName</code> object with the qname for the new
325N/A * <code>SOAPBodyElement</code> object
325N/A * @return the new <code>SOAPBodyElement</code> object
325N/A * @exception SOAPException
325N/A * if a SOAP error occurs
325N/A * @see SOAPBody#addBodyElement(Name)
325N/A * @since SAAJ 1.3
325N/A */
325N/A public SOAPBodyElement addBodyElement(QName qname) throws SOAPException;
325N/A
325N/A /**
325N/A * Adds the root node of the DOM <code>{@link org.w3c.dom.Document}</code>
325N/A * to this <code>SOAPBody</code> object.
325N/A * <p>
325N/A * Calling this method invalidates the <code>document</code> parameter.
325N/A * The client application should discard all references to this <code>Document</code>
325N/A * and its contents upon calling <code>addDocument</code>. The behavior
325N/A * of an application that continues to use such references is undefined.
325N/A *
325N/A * @param document
325N/A * the <code>Document</code> object whose root node will be
325N/A * added to this <code>SOAPBody</code>.
325N/A * @return the <code>SOAPBodyElement</code> that represents the root node
325N/A * that was added.
325N/A * @exception SOAPException
325N/A * if the <code>Document</code> cannot be added
325N/A * @since SAAJ 1.2
325N/A */
325N/A public SOAPBodyElement addDocument(org.w3c.dom.Document document)
325N/A throws SOAPException;
325N/A
325N/A /**
325N/A * Creates a new DOM <code>{@link org.w3c.dom.Document}</code> and sets
325N/A * the first child of this <code>SOAPBody</code> as it's document
325N/A * element. The child <code>SOAPElement</code> is removed as part of the
325N/A * process.
325N/A *
325N/A * @return the <code>{@link org.w3c.dom.Document}</code> representation
325N/A * of the <code>SOAPBody</code> content.
325N/A *
325N/A * @exception SOAPException
325N/A * if there is not exactly one child <code>SOAPElement</code> of the <code>
325N/A * <code>SOAPBody</code>.
325N/A *
325N/A * @since SAAJ 1.3
325N/A */
325N/A public org.w3c.dom.Document extractContentAsDocument()
325N/A throws SOAPException;
325N/A}