roshan 2003/06/27 22:09:59
Modified: c/src/soap SoapBody.h SoapBody.cpp Log: committing c++ code base Revision Changes Path 1.3 +37 -0 xml-axis/c/src/soap/SoapBody.h Index: SoapBody.h =================================================================== RCS file: /home/cvs/xml-axis/c/src/soap/SoapBody.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SoapBody.h 27 Jun 2003 04:33:39 -0000 1.2 +++ SoapBody.h 28 Jun 2003 05:09:59 -0000 1.3 @@ -76,16 +76,53 @@ #include "SoapFault.h" #include "SoapEnvVersions.h" +class Attribute; + +/** + * The SOAP Body of a SOAP Envelope according to SOAP 1.2 specification. + * + * A SOAP body provides a mechanism for transmitting information to an ultimate SOAP receiver. + * The Body element information item has: + * - A [local name] of Body . + * - A [namespace name] of "http://www.w3.org/2003/05/soap-envelope". + * - Zero or more namespace qualified attribute information items in its [attributes] property. + * - Zero or more namespace qualified element information items in its [children] property. + * + * The Body element information item MAY have any number of character information item children whose + * character code is amongst the white space characters as defined by XML 1.0 [XML 1.0]. These are + * considered significant. + * + * SOAP Body child Element: + * All child element information items of the SOAP Body element information item: + * - SHOULD have a [namespace name] property which has a value, that is the name of the element + * SHOULD be namespace qualified. + * - MAY have any number of character information item children. Child character information + * items whose character code is amongst the white space characters as defined by XML 1.0 [XML 1.0] + * are considered significant. + * - MAY have any number of element information item children. Such element information items MAY be + * namespace qualified. + * - MAY have zero or more attribute information items in its [attributes] property. Among these MAY + * be the following, which has special significance for SOAP processing: + * - encodingStyle attribute information item + * SOAP defines one particular direct child of the SOAP body, the SOAP fault, which is used for reporting + * errors + * + * @brief The SOAP Body of a SOAP Envelope according to SOAP 1.2 specification. + */ + class SoapBody { friend class SoapSerializer; private: + int serializeAttributes(string& sSerialized); + list<Attribute*> m_attributes; SoapMethod *m_pSoapMethod; SoapFault *m_pSoapFault; //string m_strBodySerialized; public: + void addAttribute(Attribute* attr); //string& serialize(); int serialize(string&, SOAP_VERSION eSoapVersion); void setSoapFault(SoapFault* ptrSoapFault); 1.3 +30 -1 xml-axis/c/src/soap/SoapBody.cpp Index: SoapBody.cpp =================================================================== RCS file: /home/cvs/xml-axis/c/src/soap/SoapBody.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SoapBody.cpp 27 Jun 2003 04:33:39 -0000 1.2 +++ SoapBody.cpp 28 Jun 2003 05:09:59 -0000 1.3 @@ -67,6 +67,7 @@ #include "SoapBody.h" #include "../common/GDefine.h" +#include "Attribute.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction @@ -104,7 +105,12 @@ int iStatus= SUCCESS; do { - sSerialized= sSerialized+ "<"+ g_sObjSoapEnvVersionsStruct[eSoapVersion].pchEnvelopePrefix+ ":" + g_sObjSoapEnvVersionsStruct[eSoapVersion].pcharWords[SKW_BODY]+ ">"+ "\n"; + sSerialized= sSerialized+ "<"+ g_sObjSoapEnvVersionsStruct[eSoapVersion].pchEnvelopePrefix+ ":" + g_sObjSoapEnvVersionsStruct[eSoapVersion].pcharWords[SKW_BODY]; + iStatus= serializeAttributes(sSerialized); + if(iStatus==FAIL) { + break; + } + sSerialized= sSerialized+ ">"+ "\n"; if(m_pSoapMethod!=NULL) { iStatus= m_pSoapMethod->serialize(sSerialized); @@ -141,3 +147,26 @@ return m_strBodySerialized; }*/ + +void SoapBody::addAttribute(Attribute *attr) +{ + m_attributes.push_back(attr); +} + +int SoapBody::serializeAttributes(string &sSerialized) +{ + int iStatus= SUCCESS; + + list<Attribute*>::iterator itCurrAttribute= m_attributes.begin(); + + while(itCurrAttribute != m_attributes.end()) { + + iStatus= (*itCurrAttribute)->serialize(sSerialized); + if(iStatus==FAIL) { + break; + } + itCurrAttribute++; + } + + return iStatus; +}
