| 1 |
/* |
| 2 |
* Copyright 2001-2004 The Apache Software Foundation. |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
* you may not use this file except in compliance with the License. |
| 6 |
* You may obtain a copy of the License at |
| 7 |
* |
| 8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
* |
| 10 |
* Unless required by applicable law or agreed to in writing, software |
| 11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
* See the License for the specific language governing permissions and |
| 14 |
* limitations under the License. |
| 15 |
*/ |
| 16 |
package javax.xml.soap; |
| 17 |
|
| 18 |
import java.util.Iterator; |
| 19 |
|
| 20 |
/** |
| 21 |
* <P>A representation of the SOAP header element. A SOAP header |
| 22 |
* element consists of XML data that affects the way the |
| 23 |
* application-specific content is processed by the message |
| 24 |
* provider. For example, transaction semantics, authentication |
| 25 |
* information, and so on, can be specified as the content of a |
| 26 |
* <CODE>SOAPHeader</CODE> object.</P> |
| 27 |
* |
| 28 |
* <P>A <CODE>SOAPEnvelope</CODE> object contains an empty <CODE> |
| 29 |
* SOAPHeader</CODE> object by default. If the <CODE> |
| 30 |
* SOAPHeader</CODE> object, which is optional, is not needed, it |
| 31 |
* can be retrieved and deleted with the following line of code. |
| 32 |
* The variable <I>se</I> is a <CODE>SOAPEnvelope</CODE> |
| 33 |
* object.</P> |
| 34 |
* <PRE> |
| 35 |
* se.getHeader().detachNode(); |
| 36 |
* </PRE> |
| 37 |
* A <CODE>SOAPHeader</CODE> object is created with the <CODE> |
| 38 |
* SOAPEnvelope</CODE> method <CODE>addHeader</CODE>. This method, |
| 39 |
* which creates a new header and adds it to the envelope, may be |
| 40 |
* called only after the existing header has been removed. |
| 41 |
* <PRE> |
| 42 |
* se.getHeader().detachNode(); |
| 43 |
* SOAPHeader sh = se.addHeader(); |
| 44 |
* </PRE> |
| 45 |
* |
| 46 |
* <P>A <CODE>SOAPHeader</CODE> object can have only <CODE> |
| 47 |
* SOAPHeaderElement</CODE> objects as its immediate children. The |
| 48 |
* method <CODE>addHeaderElement</CODE> creates a new <CODE> |
| 49 |
* HeaderElement</CODE> object and adds it to the <CODE> |
| 50 |
* SOAPHeader</CODE> object. In the following line of code, the |
| 51 |
* argument to the method <CODE>addHeaderElement</CODE> is a |
| 52 |
* <CODE>Name</CODE> object that is the name for the new <CODE> |
| 53 |
* HeaderElement</CODE> object.</P> |
| 54 |
* <PRE> |
| 55 |
* SOAPHeaderElement shElement = sh.addHeaderElement(name); |
| 56 |
* </PRE> |
| 57 |
* @see SOAPHeaderElement SOAPHeaderElement |
| 58 |
*/ |
| 59 |
public interface SOAPHeader extends SOAPElement { |
| 60 |
|
| 61 |
/** |
| 62 |
* Creates a new <CODE>SOAPHeaderElement</CODE> object |
| 63 |
* initialized with the specified name and adds it to this |
| 64 |
* <CODE>SOAPHeader</CODE> object. |
| 65 |
* @param name a <CODE>Name</CODE> object with |
| 66 |
* the name of the new <CODE>SOAPHeaderElement</CODE> |
| 67 |
* object |
| 68 |
* @return the new <CODE>SOAPHeaderElement</CODE> object that |
| 69 |
* was inserted into this <CODE>SOAPHeader</CODE> |
| 70 |
* object |
| 71 |
* @throws SOAPException if a SOAP error occurs |
| 72 |
*/ |
| 73 |
public abstract SOAPHeaderElement addHeaderElement(Name name) |
| 74 |
throws SOAPException; |
| 75 |
|
| 76 |
/** |
| 77 |
* Returns a list of all the <CODE>SOAPHeaderElement</CODE> |
| 78 |
* objects in this <CODE>SOAPHeader</CODE> object that have the |
| 79 |
* the specified actor. An actor is a global attribute that |
| 80 |
* indicates the intermediate parties to whom the message should |
| 81 |
* be sent. An actor receives the message and then sends it to |
| 82 |
* the next actor. The default actor is the ultimate intended |
| 83 |
* recipient for the message, so if no actor attribute is |
| 84 |
* included in a <CODE>SOAPHeader</CODE> object, the message is |
| 85 |
* sent to its ultimate destination. |
| 86 |
* @param actor a <CODE>String</CODE> giving the |
| 87 |
* URI of the actor for which to search |
| 88 |
* @return an <CODE>Iterator</CODE> object over all the <CODE> |
| 89 |
* SOAPHeaderElement</CODE> objects that contain the |
| 90 |
* specified actor |
| 91 |
* @see #extractHeaderElements(java.lang.String) extractHeaderElements(java.lang.String) |
| 92 |
*/ |
| 93 |
public abstract Iterator examineHeaderElements(String actor); |
| 94 |
|
| 95 |
/** |
| 96 |
* Returns a list of all the <CODE>SOAPHeaderElement</CODE> |
| 97 |
* objects in this <CODE>SOAPHeader</CODE> object that have |
| 98 |
* the the specified actor and detaches them from this <CODE> |
| 99 |
* SOAPHeader</CODE> object. |
| 100 |
* |
| 101 |
* <P>This method allows an actor to process only the parts of |
| 102 |
* the <CODE>SOAPHeader</CODE> object that apply to it and to |
| 103 |
* remove them before passing the message on to the next |
| 104 |
* actor. |
| 105 |
* @param actor a <CODE>String</CODE> giving the |
| 106 |
* URI of the actor for which to search |
| 107 |
* @return an <CODE>Iterator</CODE> object over all the <CODE> |
| 108 |
* SOAPHeaderElement</CODE> objects that contain the |
| 109 |
* specified actor |
| 110 |
* @see #examineHeaderElements(java.lang.String) examineHeaderElements(java.lang.String) |
| 111 |
*/ |
| 112 |
public abstract Iterator extractHeaderElements(String actor); |
| 113 |
|
| 114 |
/** |
| 115 |
* Returns an <code>Iterator</code> over all the |
| 116 |
* <code>SOAPHeaderElement</code> objects in this <code>SOAPHeader</code> |
| 117 |
* object that have the specified actor and that have a MustUnderstand |
| 118 |
* attribute whose value is equivalent to <code>true</code>. |
| 119 |
* |
| 120 |
* @param actor a <code>String</code> giving the URI of the actor for which |
| 121 |
* to search |
| 122 |
* @return an <code>Iterator</code> object over all the |
| 123 |
* <code>SOAPHeaderElement</code> objects that contain the |
| 124 |
* specified actor and are marked as MustUnderstand |
| 125 |
*/ |
| 126 |
public abstract Iterator examineMustUnderstandHeaderElements(String actor); |
| 127 |
|
| 128 |
/** |
| 129 |
* Returns an <code>Iterator</code> over all the |
| 130 |
* <code>SOAPHeaderElement</code> objects in this <code>SOAPHeader</code> |
| 131 |
* object. |
| 132 |
* |
| 133 |
* @return an <code>Iterator</code> object over all the |
| 134 |
* <code>SOAPHeaderElement</code> objects contained by this |
| 135 |
* <code>SOAPHeader</code> |
| 136 |
*/ |
| 137 |
public abstract Iterator examineAllHeaderElements(); |
| 138 |
|
| 139 |
/** |
| 140 |
* Returns an <code>Iterator</code> over all the |
| 141 |
* <code>SOAPHeaderElement</code> objects in this <code>SOAPHeader </code> |
| 142 |
* object and detaches them from this <code>SOAPHeader</code> object. |
| 143 |
* |
| 144 |
* @return an <code>Iterator</code> object over all the |
| 145 |
* <code>SOAPHeaderElement</code> objects contained by this |
| 146 |
* <code>SOAPHeader</code> |
| 147 |
*/ |
| 148 |
public abstract Iterator extractAllHeaderElements(); |
| 149 |
} |