SOAPBody::SOAPBody(Document* pDoc): SOAPElement(pDoc), _pBody(0) { AutoPtr<NodeList> pNode = pDoc->getElementsByTagName(envelopeTag()); poco_check_ptr(pNode); int i = pNode->length(); poco_assert(pNode->length() == 1); _pBody = pDoc->createElement(bodyTag()); poco_check_ptr(_pBody); pNode->item(0)->appendChild(_pBody); }
SOAPEnvelope::SOAPEnvelope(Document* pDoc, SOAPElement::Version version, bool header): SOAPElement(pDoc, version), _pHeader(0), _pBody(0) { _pEnvelope = document().createElement(envelopeTag()); Element* pEnv = _pEnvelope.get(); poco_check_ptr(pEnv); pEnv->setAttribute("xmlns:SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/"); pEnv->setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); pEnv->setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); pEnv->setAttribute("xmlns:SE", "http://schemas.xmlsoap.org/soap/encoding/"); document().appendChild(pEnv); if (header) _pHeader = new SOAPHeader(&document()); _pBody = new SOAPBody(&document()); }