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 ; 13 import java.util.Iterator ; 14 15 31 public class SOAP11HeaderImpl extends SOAPHeaderImpl { 32 35 public SOAP11HeaderImpl(SOAPEnvelope envelope) throws SOAPProcessingException { 36 super(envelope); 37 } 38 39 45 public SOAP11HeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder) { 46 super(envelope, builder); 47 } 48 49 public SOAPHeaderBlock addHeaderBlock(String 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 role) { 70 return new OMChildrenWithSpecificAttributeIterator(getFirstChild(), 71 new QName (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, 72 SOAP11Constants.ATTR_ACTOR), 73 role, 74 true); 75 76 } 77 78 79 80 } 81 | Popular Tags |