KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > soap > impl > llom > soap11 > SOAP11HeaderImpl


1 package org.apache.axis2.soap.impl.llom.soap11;
2
3 import org.apache.axis2.om.OMException;
4 import org.apache.axis2.om.OMNamespace;
5 import org.apache.axis2.om.OMXMLParserWrapper;
6 import org.apache.axis2.om.impl.llom.traverse.OMChildrenWithSpecificAttributeIterator;
7 import org.apache.axis2.soap.SOAPEnvelope;
8 import org.apache.axis2.soap.SOAPHeaderBlock;
9 import org.apache.axis2.soap.impl.llom.SOAPHeaderImpl;
10 import org.apache.axis2.soap.impl.llom.SOAPProcessingException;
11
12 import javax.xml.namespace.QName JavaDoc;
13 import java.util.Iterator JavaDoc;
14
15 /**
16  * Copyright 2001-2004 The Apache Software Foundation.
17  * <p/>
18  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
19  * use this file except in compliance with the License. You may obtain a copy of
20  * the License at
21  * <p/>
22  * http://www.apache.org/licenses/LICENSE-2.0
23  * <p/>
24  * Unless required by applicable law or agreed to in writing, software
25  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
26  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
27  * License for the specific language governing permissions and limitations under
28  * the License.
29  * <p/>
30  */

31 public class SOAP11HeaderImpl extends SOAPHeaderImpl {
32     /**
33      * @param envelope
34      */

35     public SOAP11HeaderImpl(SOAPEnvelope envelope) throws SOAPProcessingException {
36         super(envelope);
37     }
38
39     /**
40      * Constructor SOAPHeaderImpl
41      *
42      * @param envelope
43      * @param builder
44      */

45     public SOAP11HeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder) {
46         super(envelope, builder);
47     }
48
49     public SOAPHeaderBlock addHeaderBlock(String JavaDoc localName, OMNamespace ns) throws OMException {
50         if (ns == null || ns.getName() == null || "".equals(ns.getName())) {
51             throw new OMException("All the SOAP Header blocks should be namespace qualified");
52         }
53
54         OMNamespace namespace = findNamespace(ns.getName(), ns.getPrefix());
55         if (namespace != null) {
56             ns = namespace;
57         }
58
59         SOAPHeaderBlock soapHeaderBlock = null;
60         try {
61             soapHeaderBlock = new SOAP11HeaderBlockImpl(localName, ns, this);
62         } catch (SOAPProcessingException e) {
63             throw new OMException(e);
64         }
65         soapHeaderBlock.setComplete(true);
66         return soapHeaderBlock;
67     }
68
69     public Iterator extractHeaderBlocks(String JavaDoc role) {
70         return new OMChildrenWithSpecificAttributeIterator(getFirstChild(),
71                 new QName JavaDoc(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
72                         SOAP11Constants.ATTR_ACTOR),
73                 role,
74                 true);
75
76     }
77
78     
79
80 }
81
Popular Tags