1 16 package org.apache.axis2.soap.impl.llom; 17 18 import org.apache.axis2.om.OMAttribute; 19 import org.apache.axis2.om.OMElement; 20 import org.apache.axis2.om.OMNamespace; 21 import org.apache.axis2.om.OMXMLParserWrapper; 22 import org.apache.axis2.om.impl.llom.OMAttributeImpl; 23 import org.apache.axis2.om.impl.llom.OMElementImpl; 24 import org.apache.axis2.om.impl.llom.OMNamespaceImpl; 25 import org.apache.axis2.soap.SOAPHeader; 26 import org.apache.axis2.soap.SOAPHeaderBlock; 27 28 import javax.xml.namespace.QName ; 29 30 33 public abstract class SOAPHeaderBlockImpl extends OMElementImpl 34 implements SOAPHeaderBlock { 35 36 private boolean processed = false; 37 41 public SOAPHeaderBlockImpl(String localName, OMNamespace ns, SOAPHeader parent) throws SOAPProcessingException { 42 super(localName, ns, parent); 43 this.setNamespace(ns); 44 } 45 46 54 public SOAPHeaderBlockImpl(String localName, OMNamespace ns, 55 OMElement parent, OMXMLParserWrapper builder) { 56 super(localName, ns, parent, builder); 57 this.setNamespace(ns); 58 } 59 60 64 protected void setAttribute(String attributeName, String attrValue, String soapEnvelopeNamespaceURI) { 65 OMAttribute omAttribute = this.getFirstAttribute( 66 new QName (soapEnvelopeNamespaceURI, attributeName)); 67 if (omAttribute != null) { 68 omAttribute.setValue(attrValue); 69 } else { 70 OMAttribute attribute = new OMAttributeImpl( 71 attributeName, 72 new OMNamespaceImpl( 73 soapEnvelopeNamespaceURI, 74 SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX), attrValue); 75 this.addAttribute(attribute); 76 } 77 } 78 79 85 protected String getAttribute(String attrName, String soapEnvelopeNamespaceURI) { 86 OMAttribute omAttribute = this.getFirstAttribute( 87 new QName (soapEnvelopeNamespaceURI, attrName)); 88 return (omAttribute != null) 89 ? omAttribute.getValue() 90 : null; 91 } 92 93 public boolean isProcessed() { 94 return processed; 95 } 96 97 public void setProcessed() { 98 processed = true; 99 } 100 } 101 | Popular Tags |