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.Iterator;
325N/A
325N/Aimport javax.xml.namespace.QName;
325N/A
325N/A/**
325N/A * A representation of the SOAP header
325N/A * element. A SOAP header element consists of XML data that affects
325N/A * the way the application-specific content is processed by the message
325N/A * provider. For example, transaction semantics, authentication information,
325N/A * and so on, can be specified as the content of a <code>SOAPHeader</code>
325N/A * object.
325N/A * <P>
325N/A * A <code>SOAPEnvelope</code> object contains an empty
325N/A * <code>SOAPHeader</code> object by default. If the <code>SOAPHeader</code>
325N/A * object, which is optional, is not needed, it can be retrieved and deleted
325N/A * with the following line of code. The variable <i>se</i> is a
325N/A * <code>SOAPEnvelope</code> object.
325N/A * <PRE>
325N/A * se.getHeader().detachNode();
325N/A * </PRE>
325N/A *
325N/A * A <code>SOAPHeader</code> object is created with the <code>SOAPEnvelope</code>
325N/A * method <code>addHeader</code>. This method, which creates a new header and adds it
325N/A * to the envelope, may be called only after the existing header has been removed.
325N/A *
325N/A * <PRE>
325N/A * se.getHeader().detachNode();
325N/A * SOAPHeader sh = se.addHeader();
325N/A * </PRE>
325N/A * <P>
325N/A * A <code>SOAPHeader</code> object can have only <code>SOAPHeaderElement</code>
325N/A * objects as its immediate children. The method <code>addHeaderElement</code>
325N/A * creates a new <code>HeaderElement</code> object and adds it to the
325N/A * <code>SOAPHeader</code> object. In the following line of code, the
325N/A * argument to the method <code>addHeaderElement</code> is a <code>Name</code>
325N/A * object that is the name for the new <code>HeaderElement</code> object.
325N/A * <PRE>
325N/A * SOAPHeaderElement shElement = sh.addHeaderElement(name);
325N/A * </PRE>
325N/A *
325N/A * @see SOAPHeaderElement
325N/A */
325N/Apublic interface SOAPHeader extends SOAPElement {
325N/A /**
325N/A * Creates a new <code>SOAPHeaderElement</code> object initialized with the
325N/A * specified name and adds it to this <code>SOAPHeader</code> object.
325N/A *
325N/A * @param name a <code>Name</code> object with the name of the new
325N/A * <code>SOAPHeaderElement</code> object
325N/A * @return the new <code>SOAPHeaderElement</code> object that was
325N/A * inserted into this <code>SOAPHeader</code> object
325N/A * @exception SOAPException if a SOAP error occurs
325N/A * @see SOAPHeader#addHeaderElement(javax.xml.namespace.QName)
325N/A */
325N/A public SOAPHeaderElement addHeaderElement(Name name)
325N/A throws SOAPException;
325N/A
325N/A /**
325N/A * Creates a new <code>SOAPHeaderElement</code> object initialized with the
325N/A * specified qname and adds it to this <code>SOAPHeader</code> object.
325N/A *
325N/A * @param qname a <code>QName</code> object with the qname of the new
325N/A * <code>SOAPHeaderElement</code> object
325N/A * @return the new <code>SOAPHeaderElement</code> object that was
325N/A * inserted into this <code>SOAPHeader</code> object
325N/A * @exception SOAPException if a SOAP error occurs
325N/A * @see SOAPHeader#addHeaderElement(Name)
325N/A * @since SAAJ 1.3
325N/A */
325N/A public SOAPHeaderElement addHeaderElement(QName qname)
325N/A throws SOAPException;
325N/A
325N/A /**
325N/A * Returns an <code>Iterator</code> over all the <code>SOAPHeaderElement</code> objects
325N/A * in this <code>SOAPHeader</code> object
325N/A * that have the specified <i>actor</i> and that have a MustUnderstand attribute
325N/A * whose value is equivalent to <code>true</code>.
325N/A * <p>
325N/A * In SOAP 1.2 the <i>env:actor</i> attribute is replaced by the <i>env:role</i>
325N/A * attribute, but with essentially the same semantics.
325N/A *
325N/A * @param actor a <code>String</code> giving the URI of the <code>actor</code> / <code>role</code>
325N/A * for which to search
325N/A * @return an <code>Iterator</code> object over all the
325N/A * <code>SOAPHeaderElement</code> objects that contain the specified
325N/A * <code>actor</code> / <code>role</code> and are marked as MustUnderstand
325N/A * @see #examineHeaderElements
325N/A * @see #extractHeaderElements
325N/A * @see SOAPConstants#URI_SOAP_ACTOR_NEXT
325N/A *
325N/A * @since SAAJ 1.2
325N/A */
325N/A public Iterator examineMustUnderstandHeaderElements(String actor);
325N/A
325N/A /**
325N/A * Returns an <code>Iterator</code> over all the <code>SOAPHeaderElement</code> objects
325N/A * in this <code>SOAPHeader</code> object
325N/A * that have the specified <i>actor</i>.
325N/A *
325N/A * An <i>actor</i> is a global attribute that indicates the intermediate
325N/A * parties that should process a message before it reaches its ultimate
325N/A * receiver. An actor receives the message and processes it before sending
325N/A * it on to the next actor. The default actor is the ultimate intended
325N/A * recipient for the message, so if no actor attribute is included in a
325N/A * <code>SOAPHeader</code> object, it is sent to the ultimate receiver
325N/A * along with the message body.
325N/A * <p>
325N/A * In SOAP 1.2 the <i>env:actor</i> attribute is replaced by the <i>env:role</i>
325N/A * attribute, but with essentially the same semantics.
325N/A *
325N/A * @param actor a <code>String</code> giving the URI of the <code>actor</code> / <code>role</code>
325N/A * for which to search
325N/A * @return an <code>Iterator</code> object over all the
325N/A * <code>SOAPHeaderElement</code> objects that contain the specified
325N/A * <code>actor</code> / <code>role</code>
325N/A * @see #extractHeaderElements
325N/A * @see SOAPConstants#URI_SOAP_ACTOR_NEXT
325N/A */
325N/A public Iterator examineHeaderElements(String actor);
325N/A
325N/A /**
325N/A * Returns an <code>Iterator</code> over all the <code>SOAPHeaderElement</code> objects
325N/A * in this <code>SOAPHeader</code> object
325N/A * that have the specified <i>actor</i> and detaches them
325N/A * from this <code>SOAPHeader</code> object.
325N/A * <P>
325N/A * This method allows an actor to process the parts of the
325N/A * <code>SOAPHeader</code> object that apply to it and to remove
325N/A * them before passing the message on to the next actor.
325N/A * <p>
325N/A * In SOAP 1.2 the <i>env:actor</i> attribute is replaced by the <i>env:role</i>
325N/A * attribute, but with essentially the same semantics.
325N/A *
325N/A * @param actor a <code>String</code> giving the URI of the <code>actor</code> / <code>role</code>
325N/A * for which to search
325N/A * @return an <code>Iterator</code> object over all the
325N/A * <code>SOAPHeaderElement</code> objects that contain the specified
325N/A * <code>actor</code> / <code>role</code>
325N/A *
325N/A * @see #examineHeaderElements
325N/A * @see SOAPConstants#URI_SOAP_ACTOR_NEXT
325N/A */
325N/A public Iterator extractHeaderElements(String actor);
325N/A
325N/A /**
325N/A * Creates a new NotUnderstood <code>SOAPHeaderElement</code> object initialized
325N/A * with the specified name and adds it to this <code>SOAPHeader</code> object.
325N/A * This operation is supported only by SOAP 1.2.
325N/A *
325N/A * @param name a <code>QName</code> object with the name of the
325N/A * <code>SOAPHeaderElement</code> object that was not understood.
325N/A * @return the new <code>SOAPHeaderElement</code> object that was
325N/A * inserted into this <code>SOAPHeader</code> object
325N/A * @exception SOAPException if a SOAP error occurs.
325N/A * @exception UnsupportedOperationException if this is a SOAP 1.1 Header.
325N/A * @since SAAJ 1.3
325N/A */
325N/A public SOAPHeaderElement addNotUnderstoodHeaderElement(QName name)
325N/A throws SOAPException;
325N/A
325N/A /**
325N/A * Creates a new Upgrade <code>SOAPHeaderElement</code> object initialized
325N/A * with the specified List of supported SOAP URIs and adds it to this
325N/A * <code>SOAPHeader</code> object.
325N/A * This operation is supported on both SOAP 1.1 and SOAP 1.2 header.
325N/A *
325N/A * @param supportedSOAPURIs an <code>Iterator</code> object with the URIs of SOAP
325N/A * versions supported.
325N/A * @return the new <code>SOAPHeaderElement</code> object that was
325N/A * inserted into this <code>SOAPHeader</code> object
325N/A * @exception SOAPException if a SOAP error occurs.
325N/A * @since SAAJ 1.3
325N/A */
325N/A public SOAPHeaderElement addUpgradeHeaderElement(Iterator supportedSOAPURIs)
325N/A throws SOAPException;
325N/A
325N/A /**
325N/A * Creates a new Upgrade <code>SOAPHeaderElement</code> object initialized
325N/A * with the specified array of supported SOAP URIs and adds it to this
325N/A * <code>SOAPHeader</code> object.
325N/A * This operation is supported on both SOAP 1.1 and SOAP 1.2 header.
325N/A *
325N/A * @param supportedSoapUris an array of the URIs of SOAP versions supported.
325N/A * @return the new <code>SOAPHeaderElement</code> object that was
325N/A * inserted into this <code>SOAPHeader</code> object
325N/A * @exception SOAPException if a SOAP error occurs.
325N/A * @since SAAJ 1.3
325N/A */
325N/A public SOAPHeaderElement addUpgradeHeaderElement(String[] supportedSoapUris)
325N/A throws SOAPException;
325N/A
325N/A /**
325N/A * Creates a new Upgrade <code>SOAPHeaderElement</code> object initialized
325N/A * with the specified supported SOAP URI and adds it to this
325N/A * <code>SOAPHeader</code> object.
325N/A * This operation is supported on both SOAP 1.1 and SOAP 1.2 header.
325N/A *
325N/A * @param supportedSoapUri the URI of SOAP the version that is supported.
325N/A * @return the new <code>SOAPHeaderElement</code> object that was
325N/A * inserted into this <code>SOAPHeader</code> object
325N/A * @exception SOAPException if a SOAP error occurs.
325N/A * @since SAAJ 1.3
325N/A */
325N/A public SOAPHeaderElement addUpgradeHeaderElement(String supportedSoapUri)
325N/A throws SOAPException;
325N/A
325N/A /**
325N/A * Returns an <code>Iterator</code> over all the <code>SOAPHeaderElement</code> objects
325N/A * in this <code>SOAPHeader</code> object.
325N/A *
325N/A * @return an <code>Iterator</code> object over all the
325N/A * <code>SOAPHeaderElement</code> objects contained by this
325N/A * <code>SOAPHeader</code>
325N/A * @see #extractAllHeaderElements
325N/A *
325N/A * @since SAAJ 1.2
325N/A */
325N/A public Iterator examineAllHeaderElements();
325N/A
325N/A /**
325N/A * Returns an <code>Iterator</code> over all the <code>SOAPHeaderElement</code> objects
325N/A * in this <code>SOAPHeader</code> object and detaches them
325N/A * from this <code>SOAPHeader</code> object.
325N/A *
325N/A * @return an <code>Iterator</code> object over all the
325N/A * <code>SOAPHeaderElement</code> objects contained by this
325N/A * <code>SOAPHeader</code>
325N/A *
325N/A * @see #examineAllHeaderElements
325N/A *
325N/A * @since SAAJ 1.2
325N/A */
325N/A public Iterator extractAllHeaderElements();
325N/A
325N/A}