def create(self): """Create header ElementTree element""" self.elem = etree.makeEtreeElement(str(self.qname), SOAPBodyBase.DEFAULT_ELEMENT_NS_PREFIX, SOAPBodyBase.DEFAULT_ELEMENT_NS) if self.hasSOAPFault: self.fault.create() self.elem.append(self.fault.elem)
def create(self): """Create Fault ElementTree element""" self.elem = etree.makeEtreeElement(str(self.qname), SOAPFaultBase.DEFAULT_ELEMENT_NS_PREFIX, SOAPFaultBase.DEFAULT_ELEMENT_NS) faultStringElem = etree.makeEtreeElement( str(self.__class__.FAULT_STRING_ELEMENT_NAME), SOAPFaultBase.DEFAULT_ELEMENT_NS_PREFIX, SOAPFaultBase.DEFAULT_ELEMENT_NS) faultStringElem.text = self.faultString self.elem.append(faultStringElem) faultCodeElem = etree.makeEtreeElement( str(self.__class__.FAULT_CODE_ELEMENT_NAME), SOAPFaultBase.DEFAULT_ELEMENT_NS_PREFIX, SOAPFaultBase.DEFAULT_ELEMENT_NS) faultCodeElem.text = self.faultCode self.elem.append(faultCodeElem) if self.faultActor is not None: faultActorElem = etree.makeEtreeElement( str(self.__class__.FAULT_ACTOR_ELEMENT_NAME), SOAPFaultBase.DEFAULT_ELEMENT_NS_PREFIX, SOAPFaultBase.DEFAULT_ELEMENT_NS) faultActorElem.text = self.faultActor self.elem.append(faultActorElem) if self.detail is not None: detailElem = etree.makeEtreeElement( str(self.__class__.DETAIL_ELEMENT_NAME), SOAPFaultBase.DEFAULT_ELEMENT_NS_PREFIX, SOAPFaultBase.DEFAULT_ELEMENT_NS) if ElementTree.iselement(self.detail): detailElem.append(self.detail) elif isinstance(self.detail, basestring): detailElem.text = self.detail else: raise TypeError('Expecting ElementTree.Element or string ' 'type for SOAPFault detail; got %r' % type(self.detail)) self.elem.append(detailElem)
def create(self): """Create SOAP Envelope with header and body""" self.elem = etree.makeEtreeElement(str(self.qname), SOAPEnvelopeBase.DEFAULT_ELEMENT_NS_PREFIX, SOAPEnvelopeBase.DEFAULT_ELEMENT_NS) self.header.create() self.elem.append(self.header.elem) self.body.create() self.elem.append(self.body.elem)
def create(self): """Create header ElementTree element""" self.elem = etree.makeEtreeElement(str(self.qname), SOAPHeaderBase.DEFAULT_ELEMENT_NS_PREFIX, SOAPHeaderBase.DEFAULT_ELEMENT_NS)