Return-Path: Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 40680 invoked by uid 500); 15 Jul 2003 07:05:09 -0000 Mailing-List: contact axis-dev-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@ws.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-dev@ws.apache.org Received: (qmail 40619 invoked by uid 500); 15 Jul 2003 07:05:08 -0000 Delivered-To: apmail-xml-axis-cvs@apache.org Date: 15 Jul 2003 07:05:07 -0000 Message-ID: <20030715070507.61070.qmail@icarus.apache.org> From: roshan@apache.org To: xml-axis-cvs@apache.org Subject: cvs commit: xml-axis/c/src/soap SoapHeader.h SoapHeader.cpp SoapFault.h SoapFault.cpp SoapEnvelope.h SoapEnvelope.cpp SoapDeSerializer.h X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N roshan 2003/07/15 00:05:07 Modified: c/src/soap SoapHeader.h SoapHeader.cpp SoapFault.h SoapFault.cpp SoapEnvelope.h SoapEnvelope.cpp SoapDeSerializer.h Log: added code Revision Changes Path 1.4 +7 -4 xml-axis/c/src/soap/SoapHeader.h Index: SoapHeader.h =================================================================== RCS file: /home/cvs/xml-axis/c/src/soap/SoapHeader.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- SoapHeader.h 27 Jun 2003 05:56:07 -0000 1.3 +++ SoapHeader.h 15 Jul 2003 07:05:06 -0000 1.4 @@ -92,9 +92,11 @@ class SoapHeader { -private: - int serializeNamespaceDecl(string&); - int serializeAttributes(string&); +private: + int serializeNamespaceDecl(SoapSerializer& pSZ); + //int serializeNamespaceDecl(string&); + int serializeAttributes(SoapSerializer& pSZ); + //int serializeAttributes(string&); list m_attributes; list m_namespaceDecls; list m_headerBlocks; @@ -103,7 +105,8 @@ int addNamespaceDecl(Attribute* pAttribute); int addAttribute(Attribute* pAttribute); //string& serialize(); - int serialize(string&, SOAP_VERSION eSoapVersion); + int serialize(SoapSerializer& pSZ, SOAP_VERSION eSoapVersion); + //int serialize(string&, SOAP_VERSION eSoapVersion); void addHeaderBlock(HeaderBlock* headerBlock); SoapHeader(); virtual ~SoapHeader(); 1.4 +75 -20 xml-axis/c/src/soap/SoapHeader.cpp Index: SoapHeader.cpp =================================================================== RCS file: /home/cvs/xml-axis/c/src/soap/SoapHeader.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- SoapHeader.cpp 27 Jun 2003 05:56:07 -0000 1.3 +++ SoapHeader.cpp 15 Jul 2003 07:05:06 -0000 1.4 @@ -66,6 +66,7 @@ ////////////////////////////////////////////////////////////////////// #include "SoapHeader.h" +#include "SoapSerializer.h" #include "../common/GDefine.h" ////////////////////////////////////////////////////////////////////// @@ -105,6 +106,47 @@ m_headerBlocks.push_back(headerBlock); } +int SoapHeader::serialize(SoapSerializer& pSZ, SOAP_VERSION eSoapVersion) +{ + int iStatus= SUCCESS; + + do { + + pSZ << "<" << g_sObjSoapEnvVersionsStruct[eSoapVersion].pchEnvelopePrefix << ":" << g_sObjSoapEnvVersionsStruct[eSoapVersion].pcharWords[SKW_HEADER]; + + iStatus= serializeNamespaceDecl(pSZ); + iStatus= serializeAttributes(pSZ); + + if(iStatus==FAIL) { + break; + } + + pSZ<< ">"; + + list::iterator itCurrHeaderBlock= m_headerBlocks.begin(); + + while(itCurrHeaderBlock != m_headerBlocks.end()) { + iStatus= (*itCurrHeaderBlock)->serialize(pSZ); + if(iStatus==FAIL) { + break; + } + itCurrHeaderBlock++; + } + + if(iStatus==FAIL) { + break; + } + + pSZ<< ""; + + } while(0); + + return iStatus; + +} + +/* +commented on 10/7/2003 3.50pm int SoapHeader::serialize(string& sSerialized, SOAP_VERSION eSoapVersion) { int iStatus= SUCCESS; @@ -143,26 +185,7 @@ return iStatus; } - -/*string& SoapHeader::serialize() -{ - - m_strHeaderSerialized=""; - - m_strHeaderSerialized= ""; - - list::iterator itCurrHeaderBlock= m_headerBlocks.begin(); - - while(itCurrHeaderBlock != m_headerBlocks.end()) { - m_strHeaderSerialized= m_strHeaderSerialized + (*itCurrHeaderBlock)->serialize(); - itCurrHeaderBlock++; - } - - m_strHeaderSerialized= m_strHeaderSerialized + ""; - - return m_strHeaderSerialized; - -}*/ +*/ int SoapHeader::addAttribute(Attribute *pAttribute) { @@ -171,6 +194,21 @@ return SUCCESS; } + +int SoapHeader::serializeAttributes(SoapSerializer& pSZ) +{ + list::iterator itCurrAttribute= m_attributes.begin(); + + while(itCurrAttribute != m_attributes.end()) { + (*itCurrAttribute)->serialize(pSZ); + itCurrAttribute++; + } + + return SUCCESS; +} + +/* +comm on 10/7/2003 3.55pm int SoapHeader::serializeAttributes(string& sSerialized) { list::iterator itCurrAttribute= m_attributes.begin(); @@ -182,6 +220,7 @@ return SUCCESS; } +*/ int SoapHeader::addNamespaceDecl(Attribute *pAttribute) { @@ -190,6 +229,21 @@ return SUCCESS; } +int SoapHeader::serializeNamespaceDecl(SoapSerializer& pSZ) +{ + list::iterator itCurrNamespaceDecl= m_namespaceDecls.begin(); + + while(itCurrNamespaceDecl != m_namespaceDecls.end()) { + + (*itCurrNamespaceDecl)->serialize(pSZ); + itCurrNamespaceDecl++; + } + + return SUCCESS; +} + +/* +comm on 10/7/2003 3.55pm int SoapHeader::serializeNamespaceDecl(string& sSerialized) { list::iterator itCurrNamespaceDecl= m_namespaceDecls.begin(); @@ -202,3 +256,4 @@ return SUCCESS; } +*/ 1.3 +5 -3 xml-axis/c/src/soap/SoapFault.h Index: SoapFault.h =================================================================== RCS file: /home/cvs/xml-axis/c/src/soap/SoapFault.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SoapFault.h 27 Jun 2003 04:15:00 -0000 1.2 +++ SoapFault.h 15 Jul 2003 07:05:06 -0000 1.3 @@ -77,15 +77,17 @@ #include #include "SoapFaults.h" +class SoapSerializer; + using namespace std; class SoapFault { public: static SoapFault* getSoapFault(int); - static void initialize(); - //string& serialize(); - int serialize(string&); + static void initialize(); + int serialize(SoapSerializer& pSZ); + //int serialize(string&); virtual ~SoapFault(); private: SoapFault(); 1.3 +27 -21 xml-axis/c/src/soap/SoapFault.cpp Index: SoapFault.cpp =================================================================== RCS file: /home/cvs/xml-axis/c/src/soap/SoapFault.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SoapFault.cpp 27 Jun 2003 04:23:15 -0000 1.2 +++ SoapFault.cpp 15 Jul 2003 07:05:06 -0000 1.3 @@ -66,6 +66,7 @@ ////////////////////////////////////////////////////////////////////// #include "SoapFault.h" +#include "SoapSerializer.h" #include "SoapEnvVersions.h" #include "../common/GDefine.h" @@ -114,6 +115,31 @@ return SUCCESS; }*/ +int SoapFault::serialize(SoapSerializer& pSZ) +{ + //written according to SOAP Version 1.1 + + int iStatus= SUCCESS; + + pSZ << ""; + pSZ << "" << m_sFaultcode.c_str()<< ""; + pSZ << ""<"; + + if(!m_sFaultactor.empty()) { + pSZ<< ""<< m_sFaultactor.c_str() <<""; + } + + if(!m_sDetail.empty()) { + pSZ<< "" << m_sDetail.c_str() <<""; + } + + pSZ<< ""; + + return iStatus; +} + +/* +comm on 11/7/2003 at 9.30am int SoapFault::serialize(string& sSerialized) { //written according to SOAP Version 1.1 @@ -136,27 +162,7 @@ return iStatus; } - -/*string& SoapFault::serialize() -{ - //written according to SOAP Version 1.2 Part 1 specification - // 17 December 2001 Working Draft. - - m_sFaultSerialized=""; - - m_sFaultSerialized= ""+ m_sFaultcode+ ""+ - ""+m_sFaultstring+""; - - if(!m_sFaultactor.empty()) { - m_sFaultSerialized+= ""+ m_sFaultactor +""; - } - - if(!m_sDetail.empty()) { - m_sFaultSerialized+= ""+ m_sDetail +""; - } - - return m_sFaultSerialized; -}*/ +*/ void SoapFault::initialize() { 1.3 +7 -7 xml-axis/c/src/soap/SoapEnvelope.h Index: SoapEnvelope.h =================================================================== RCS file: /home/cvs/xml-axis/c/src/soap/SoapEnvelope.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SoapEnvelope.h 27 Jun 2003 04:31:39 -0000 1.2 +++ SoapEnvelope.h 15 Jul 2003 07:05:06 -0000 1.3 @@ -81,10 +81,10 @@ friend class SoapSerializer; private: - int serializeNamespaceDecl(string&); - //string serializeNamespaceDecl(); - int serializeAttributes(string&); - //string serializeAttributes(); + int serializeNamespaceDecl(SoapSerializer& pSZ); + //int serializeNamespaceDecl(string&); + int serializeAttributes(SoapSerializer& pSZ); + //int serializeAttributes(string&); SoapHeader *m_pSoapHeader; SoapBody *m_pSoapBody; //string m_strEnvelopSerialized; @@ -95,9 +95,9 @@ public: int setPrefix(const string& prefix); int addNamespaceDecl(Attribute* pAttribute); - int addAttribute(Attribute* pAttribute); - int serialize(string&, SOAP_VERSION iSoapVersion); - //string& serialize() + int addAttribute(Attribute* pAttribute); + int serialize(SoapSerializer& pSZ, SOAP_VERSION eSoapVersion); + //int serialize(string &sSerialized, SOAP_VERSION eSoapVersion); void setSoapBody(SoapBody* soapBody); void setSoapHeader(SoapHeader* soapHeader); SoapEnvelope(); 1.3 +64 -61 xml-axis/c/src/soap/SoapEnvelope.cpp Index: SoapEnvelope.cpp =================================================================== RCS file: /home/cvs/xml-axis/c/src/soap/SoapEnvelope.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SoapEnvelope.cpp 27 Jun 2003 04:31:40 -0000 1.2 +++ SoapEnvelope.cpp 15 Jul 2003 07:05:06 -0000 1.3 @@ -67,6 +67,7 @@ #include "SoapEnvelope.h" #include "../common/GDefine.h" +#include "SoapSerializer.h" #include @@ -123,7 +124,49 @@ m_pSoapBody= soapBody; } -int SoapEnvelope::serialize(string& sSerialized, SOAP_VERSION eSoapVersion) +int SoapEnvelope::serialize(SoapSerializer& pSZ, SOAP_VERSION eSoapVersion) +{ + + int iStatus= SUCCESS; + + do { + + pSZ << "<" << g_sObjSoapEnvVersionsStruct[eSoapVersion].pchEnvelopePrefix << ":" << g_sObjSoapEnvVersionsStruct[eSoapVersion].pcharWords[SKW_ENVELOPE]; + + + serializeNamespaceDecl(pSZ); + serializeAttributes(pSZ); + + pSZ << ">"; + + if(m_pSoapHeader!=NULL) { + iStatus= m_pSoapHeader->serialize(pSZ, eSoapVersion); + if(iStatus == FAIL) { + break; + } + } + + if(m_pSoapBody!=NULL) { + iStatus= m_pSoapBody->serialize(pSZ, eSoapVersion); + if(iStatus == FAIL) { + break; + } + } else { + //throw exception + //iStatus = FAIL; + } + + pSZ << ""; + + pSZ.flushSerializedBuffer(); + } while(0); + + return iStatus; +} + +/* +commented on 10Jul2003 +int SoapEnvelope::serialize(string &sSerialized, SOAP_VERSION eSoapVersion) { int iStatus= SUCCESS; @@ -157,38 +200,6 @@ } while(0); return iStatus; -} - -/*string& SoapEnvelope::serialize() -{ - m_strEnvelopSerialized= "<"+ m_sPrefix+ ":"+ m_sLocalname; - - string sNamespaceDeclSerialized= serializeNamespaceDecl(); - string sAttributeSerialized= serializeAttributes(); - - if(!sNamespaceDeclSerialized.empty()) { - m_strEnvelopSerialized+= " "+ sNamespaceDeclSerialized; - } - - if(!sAttributeSerialized.empty()) { - m_strEnvelopSerialized+= " "+ sAttributeSerialized; - } - - m_strEnvelopSerialized+= ">"; - - if(m_pSoapHeader!=NULL) { - m_strEnvelopSerialized= m_strEnvelopSerialized+ m_pSoapHeader->serialize(); - } - - if(m_pSoapBody!=NULL) { - m_strEnvelopSerialized= m_strEnvelopSerialized+ m_pSoapBody->serialize(); - } else { - //throw exception - } - - m_strEnvelopSerialized+= ""; - - return m_strEnvelopSerialized; }*/ /* @@ -213,12 +224,12 @@ return SUCCESS; } -int SoapEnvelope::serializeAttributes(string& sSerialized) +int SoapEnvelope::serializeAttributes(SoapSerializer& pSZ) { list::iterator itCurrAttribute= m_attributes.begin(); while(itCurrAttribute != m_attributes.end()) { - (*itCurrAttribute)->serialize(sSerialized); + (*itCurrAttribute)->serialize(pSZ); itCurrAttribute++; } @@ -226,58 +237,50 @@ } /* -string SoapEnvelope::serializeAttributes() -{ - string strAttrSerialized=""; - +commented on 10Jul2003 3.30 pm +int SoapEnvelope::serializeAttributes(string& sSerialized) +{ list::iterator itCurrAttribute= m_attributes.begin(); while(itCurrAttribute != m_attributes.end()) { - - strAttrSerialized= strAttrSerialized+ (*itCurrAttribute)->serialize(); - itCurrAttribute++; - - if(itCurrAttribute != m_attributes.end()) { - strAttrSerialized= strAttrSerialized+ " "; - } + (*itCurrAttribute)->serialize(sSerialized); + itCurrAttribute++; } - return strAttrSerialized; + return SUCCESS; } */ -int SoapEnvelope::serializeNamespaceDecl(string& sSerialized) +int SoapEnvelope::serializeNamespaceDecl(SoapSerializer& pSZ) { list::iterator itCurrNamespaceDecl= m_namespaceDecls.begin(); while(itCurrNamespaceDecl != m_namespaceDecls.end()) { - (*itCurrNamespaceDecl)->serialize(sSerialized); + (*itCurrNamespaceDecl)->serialize(pSZ); itCurrNamespaceDecl++; } return SUCCESS; } -/*string SoapEnvelope::serializeNamespaceDecl() -{ - string strNamespaceDeclSerialized=""; +/* +commented on 10Jul2003 3.30 pm +int SoapEnvelope::serializeNamespaceDecl(string& sSerialized) +{ list::iterator itCurrNamespaceDecl= m_namespaceDecls.begin(); - while(itCurrNamespaceDecl != m_namespaceDecls.end()) { - - strNamespaceDeclSerialized= strNamespaceDeclSerialized+ (*itCurrNamespaceDecl)->serialize(); - itCurrNamespaceDecl++; + while(itCurrNamespaceDecl != m_namespaceDecls.end()) { - if(itCurrNamespaceDecl != m_namespaceDecls.end()) { - strNamespaceDeclSerialized= strNamespaceDeclSerialized+ " "; - } + (*itCurrNamespaceDecl)->serialize(sSerialized); + itCurrNamespaceDecl++; } - return strNamespaceDeclSerialized; -}*/ + return SUCCESS; +} +*/ /* * This method is needed in the situation where we create and fill a 1.2 +2 -1 xml-axis/c/src/soap/SoapDeSerializer.h Index: SoapDeSerializer.h =================================================================== RCS file: /home/cvs/xml-axis/c/src/soap/SoapDeSerializer.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- SoapDeSerializer.h 25 Jun 2003 08:14:10 -0000 1.1 +++ SoapDeSerializer.h 15 Jul 2003 07:05:06 -0000 1.2 @@ -78,8 +78,9 @@ #include "SoapBody.h" #include "SoapFault.h" #include "../common/Param.h" +#include "../common/ISoapDeSerializer.h" -class SoapDeSerializer +class SoapDeSerializer : public ISoapDeSerializer { private: XMLStreamHandler* m_pHandler;