Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPHeader.java
38890 views
/*1* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.xml.soap;2627import java.util.Iterator;2829import javax.xml.namespace.QName;3031/**32* A representation of the SOAP header33* element. A SOAP header element consists of XML data that affects34* the way the application-specific content is processed by the message35* provider. For example, transaction semantics, authentication information,36* and so on, can be specified as the content of a <code>SOAPHeader</code>37* object.38* <P>39* A <code>SOAPEnvelope</code> object contains an empty40* <code>SOAPHeader</code> object by default. If the <code>SOAPHeader</code>41* object, which is optional, is not needed, it can be retrieved and deleted42* with the following line of code. The variable <i>se</i> is a43* <code>SOAPEnvelope</code> object.44* <PRE>45* se.getHeader().detachNode();46* </PRE>47*48* A <code>SOAPHeader</code> object is created with the <code>SOAPEnvelope</code>49* method <code>addHeader</code>. This method, which creates a new header and adds it50* to the envelope, may be called only after the existing header has been removed.51*52* <PRE>53* se.getHeader().detachNode();54* SOAPHeader sh = se.addHeader();55* </PRE>56* <P>57* A <code>SOAPHeader</code> object can have only <code>SOAPHeaderElement</code>58* objects as its immediate children. The method <code>addHeaderElement</code>59* creates a new <code>HeaderElement</code> object and adds it to the60* <code>SOAPHeader</code> object. In the following line of code, the61* argument to the method <code>addHeaderElement</code> is a <code>Name</code>62* object that is the name for the new <code>HeaderElement</code> object.63* <PRE>64* SOAPHeaderElement shElement = sh.addHeaderElement(name);65* </PRE>66*67* @see SOAPHeaderElement68*/69public interface SOAPHeader extends SOAPElement {70/**71* Creates a new <code>SOAPHeaderElement</code> object initialized with the72* specified name and adds it to this <code>SOAPHeader</code> object.73*74* @param name a <code>Name</code> object with the name of the new75* <code>SOAPHeaderElement</code> object76* @return the new <code>SOAPHeaderElement</code> object that was77* inserted into this <code>SOAPHeader</code> object78* @exception SOAPException if a SOAP error occurs79* @see SOAPHeader#addHeaderElement(javax.xml.namespace.QName)80*/81public SOAPHeaderElement addHeaderElement(Name name)82throws SOAPException;8384/**85* Creates a new <code>SOAPHeaderElement</code> object initialized with the86* specified qname and adds it to this <code>SOAPHeader</code> object.87*88* @param qname a <code>QName</code> object with the qname of the new89* <code>SOAPHeaderElement</code> object90* @return the new <code>SOAPHeaderElement</code> object that was91* inserted into this <code>SOAPHeader</code> object92* @exception SOAPException if a SOAP error occurs93* @see SOAPHeader#addHeaderElement(Name)94* @since SAAJ 1.395*/96public SOAPHeaderElement addHeaderElement(QName qname)97throws SOAPException;9899/**100* Returns an <code>Iterator</code> over all the <code>SOAPHeaderElement</code> objects101* in this <code>SOAPHeader</code> object102* that have the specified <i>actor</i> and that have a MustUnderstand attribute103* whose value is equivalent to <code>true</code>.104* <p>105* In SOAP 1.2 the <i>env:actor</i> attribute is replaced by the <i>env:role</i>106* attribute, but with essentially the same semantics.107*108* @param actor a <code>String</code> giving the URI of the <code>actor</code> / <code>role</code>109* for which to search110* @return an <code>Iterator</code> object over all the111* <code>SOAPHeaderElement</code> objects that contain the specified112* <code>actor</code> / <code>role</code> and are marked as MustUnderstand113* @see #examineHeaderElements114* @see #extractHeaderElements115* @see SOAPConstants#URI_SOAP_ACTOR_NEXT116*117* @since SAAJ 1.2118*/119public Iterator examineMustUnderstandHeaderElements(String actor);120121/**122* Returns an <code>Iterator</code> over all the <code>SOAPHeaderElement</code> objects123* in this <code>SOAPHeader</code> object124* that have the specified <i>actor</i>.125*126* An <i>actor</i> is a global attribute that indicates the intermediate127* parties that should process a message before it reaches its ultimate128* receiver. An actor receives the message and processes it before sending129* it on to the next actor. The default actor is the ultimate intended130* recipient for the message, so if no actor attribute is included in a131* <code>SOAPHeader</code> object, it is sent to the ultimate receiver132* along with the message body.133* <p>134* In SOAP 1.2 the <i>env:actor</i> attribute is replaced by the <i>env:role</i>135* attribute, but with essentially the same semantics.136*137* @param actor a <code>String</code> giving the URI of the <code>actor</code> / <code>role</code>138* for which to search139* @return an <code>Iterator</code> object over all the140* <code>SOAPHeaderElement</code> objects that contain the specified141* <code>actor</code> / <code>role</code>142* @see #extractHeaderElements143* @see SOAPConstants#URI_SOAP_ACTOR_NEXT144*/145public Iterator examineHeaderElements(String actor);146147/**148* Returns an <code>Iterator</code> over all the <code>SOAPHeaderElement</code> objects149* in this <code>SOAPHeader</code> object150* that have the specified <i>actor</i> and detaches them151* from this <code>SOAPHeader</code> object.152* <P>153* This method allows an actor to process the parts of the154* <code>SOAPHeader</code> object that apply to it and to remove155* them before passing the message on to the next actor.156* <p>157* In SOAP 1.2 the <i>env:actor</i> attribute is replaced by the <i>env:role</i>158* attribute, but with essentially the same semantics.159*160* @param actor a <code>String</code> giving the URI of the <code>actor</code> / <code>role</code>161* for which to search162* @return an <code>Iterator</code> object over all the163* <code>SOAPHeaderElement</code> objects that contain the specified164* <code>actor</code> / <code>role</code>165*166* @see #examineHeaderElements167* @see SOAPConstants#URI_SOAP_ACTOR_NEXT168*/169public Iterator extractHeaderElements(String actor);170171/**172* Creates a new NotUnderstood <code>SOAPHeaderElement</code> object initialized173* with the specified name and adds it to this <code>SOAPHeader</code> object.174* This operation is supported only by SOAP 1.2.175*176* @param name a <code>QName</code> object with the name of the177* <code>SOAPHeaderElement</code> object that was not understood.178* @return the new <code>SOAPHeaderElement</code> object that was179* inserted into this <code>SOAPHeader</code> object180* @exception SOAPException if a SOAP error occurs.181* @exception UnsupportedOperationException if this is a SOAP 1.1 Header.182* @since SAAJ 1.3183*/184public SOAPHeaderElement addNotUnderstoodHeaderElement(QName name)185throws SOAPException;186187/**188* Creates a new Upgrade <code>SOAPHeaderElement</code> object initialized189* with the specified List of supported SOAP URIs and adds it to this190* <code>SOAPHeader</code> object.191* This operation is supported on both SOAP 1.1 and SOAP 1.2 header.192*193* @param supportedSOAPURIs an <code>Iterator</code> object with the URIs of SOAP194* versions supported.195* @return the new <code>SOAPHeaderElement</code> object that was196* inserted into this <code>SOAPHeader</code> object197* @exception SOAPException if a SOAP error occurs.198* @since SAAJ 1.3199*/200public SOAPHeaderElement addUpgradeHeaderElement(Iterator supportedSOAPURIs)201throws SOAPException;202203/**204* Creates a new Upgrade <code>SOAPHeaderElement</code> object initialized205* with the specified array of supported SOAP URIs and adds it to this206* <code>SOAPHeader</code> object.207* This operation is supported on both SOAP 1.1 and SOAP 1.2 header.208*209* @param supportedSoapUris an array of the URIs of SOAP versions supported.210* @return the new <code>SOAPHeaderElement</code> object that was211* inserted into this <code>SOAPHeader</code> object212* @exception SOAPException if a SOAP error occurs.213* @since SAAJ 1.3214*/215public SOAPHeaderElement addUpgradeHeaderElement(String[] supportedSoapUris)216throws SOAPException;217218/**219* Creates a new Upgrade <code>SOAPHeaderElement</code> object initialized220* with the specified supported SOAP URI and adds it to this221* <code>SOAPHeader</code> object.222* This operation is supported on both SOAP 1.1 and SOAP 1.2 header.223*224* @param supportedSoapUri the URI of SOAP the version that is supported.225* @return the new <code>SOAPHeaderElement</code> object that was226* inserted into this <code>SOAPHeader</code> object227* @exception SOAPException if a SOAP error occurs.228* @since SAAJ 1.3229*/230public SOAPHeaderElement addUpgradeHeaderElement(String supportedSoapUri)231throws SOAPException;232233/**234* Returns an <code>Iterator</code> over all the <code>SOAPHeaderElement</code> objects235* in this <code>SOAPHeader</code> object.236*237* @return an <code>Iterator</code> object over all the238* <code>SOAPHeaderElement</code> objects contained by this239* <code>SOAPHeader</code>240* @see #extractAllHeaderElements241*242* @since SAAJ 1.2243*/244public Iterator examineAllHeaderElements();245246/**247* Returns an <code>Iterator</code> over all the <code>SOAPHeaderElement</code> objects248* in this <code>SOAPHeader</code> object and detaches them249* from this <code>SOAPHeader</code> object.250*251* @return an <code>Iterator</code> object over all the252* <code>SOAPHeaderElement</code> objects contained by this253* <code>SOAPHeader</code>254*255* @see #examineAllHeaderElements256*257* @since SAAJ 1.2258*/259public Iterator extractAllHeaderElements();260261}262263264