1 package org.apache.axis2.soap.impl.llom.soap12; 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 SOAP12HeaderImpl extends SOAPHeaderImpl { 32 35 36 39 public SOAP12HeaderImpl(SOAPEnvelope envelope) throws SOAPProcessingException { 40 super(envelope); 41 } 42 43 49 public SOAP12HeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder) { 50 super(envelope, builder); 51 } 52 53 public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns) throws OMException { 54 if (ns == null || ns.getName() == null || "".equals(ns.getName())) { 55 throw new OMException("All the SOAP Header blocks should be namespace qualified"); 56 } 57 58 OMNamespace namespace = findNamespace(ns.getName(), ns.getPrefix()); 59 if (namespace != null) { 60 ns = namespace; 61 } 62 63 SOAPHeaderBlock soapHeaderBlock = null; 64 try { 65 soapHeaderBlock = new SOAP12HeaderBlockImpl(localName, ns, this); 66 } catch (SOAPProcessingException e) { 67 throw new OMException(e); 68 } 69 soapHeaderBlock.setComplete(true); 70 return soapHeaderBlock; 71 } 72 73 74 public Iterator extractHeaderBlocks(String role) { 75 return new OMChildrenWithSpecificAttributeIterator(getFirstChild(), 76 new QName (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, 77 SOAP12Constants.SOAP_ROLE), 78 role, 79 true); 80 } 81 82 } 83 | Popular Tags |