You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ro...@apache.org on 2003/07/15 09:07:17 UTC

cvs commit: xml-axis/c/src/soap SoapBody.h SoapBody.cpp HeaderBlock.h HeaderBlock.cpp

roshan      2003/07/15 00:07:17

  Modified:    c/src/soap SoapBody.h SoapBody.cpp HeaderBlock.h
                        HeaderBlock.cpp
  Log:
  added code
  
  Revision  Changes    Path
  1.4       +3 -2      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SoapBody.h	28 Jun 2003 05:09:59 -0000	1.3
  +++ SoapBody.h	15 Jul 2003 07:07:17 -0000	1.4
  @@ -115,7 +115,7 @@
   friend class SoapSerializer;
   
   private:
  -	int serializeAttributes(string& sSerialized);
  +	int serializeAttributes(SoapSerializer& pSZ);
   	list<Attribute*> m_attributes;
   	SoapMethod *m_pSoapMethod;
   	SoapFault *m_pSoapFault;
  @@ -124,7 +124,8 @@
   public:
   	void addAttribute(Attribute* attr);
   	//string& serialize();
  -	int serialize(string&, SOAP_VERSION eSoapVersion);
  +	int serialize(SoapSerializer& pSZ, SOAP_VERSION eSoapVersion);
  +	//int serialize(string&, SOAP_VERSION eSoapVersion);
   	void setSoapFault(SoapFault* ptrSoapFault);
   	void setSoapMethod(SoapMethod* ptrSoapMethod);
   	SoapBody();
  
  
  
  1.5       +53 -15    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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SoapBody.cpp	30 Jun 2003 06:17:16 -0000	1.4
  +++ SoapBody.cpp	15 Jul 2003 07:07:17 -0000	1.5
  @@ -66,6 +66,7 @@
   //////////////////////////////////////////////////////////////////////
   
   #include "SoapBody.h"
  +#include "SoapSerializer.h"
   #include "../common/GDefine.h"
   #include "Attribute.h"
   
  @@ -100,6 +101,39 @@
   	m_pSoapFault= ptrSoapFault;
   }
   
  +int SoapBody::serialize(SoapSerializer& pSZ, SOAP_VERSION eSoapVersion)
  +{
  +	int iStatus= SUCCESS;
  +
  +	do {		
  +		pSZ<< "<" << g_sObjSoapEnvVersionsStruct[eSoapVersion].pchEnvelopePrefix << ":" << g_sObjSoapEnvVersionsStruct[eSoapVersion].pcharWords[SKW_BODY];
  +		iStatus= serializeAttributes(pSZ);
  +		if(iStatus==FAIL) {
  +			break;
  +		}
  +		
  +		pSZ<< ">";
  +
  +		if(m_pSoapMethod!=NULL) {
  +			iStatus= m_pSoapMethod->serialize(pSZ);
  +			if(iStatus==FAIL) {
  +				break;
  +			}
  +		} else if(m_pSoapFault!=NULL) {		
  +			iStatus= m_pSoapFault->serialize(pSZ);
  +			if(iStatus==FAIL) {
  +				break;
  +			}
  +		}
  +		
  +		pSZ<< "</"<< g_sObjSoapEnvVersionsStruct[eSoapVersion].pchEnvelopePrefix<< ":" << g_sObjSoapEnvVersionsStruct[eSoapVersion].pcharWords[SKW_BODY]<< ">";
  +	} while(0);
  +
  +	return iStatus;
  +}
  +
  +/*
  +comm on 10/7/2003 9.10pm
   int SoapBody::serialize(string& sSerialized, SOAP_VERSION eSoapVersion)
   {
   	int iStatus= SUCCESS;
  @@ -129,30 +163,33 @@
   
   	return iStatus;
   }
  +*/
   
  -/*string& SoapBody::serialize()
  +void SoapBody::addAttribute(Attribute *attr)
   {
  -	m_strBodySerialized="";
  +	m_attributes.push_back(attr);
  +}
   
  -	m_strBodySerialized="<SOAP-ENV:Body>";
  +int SoapBody::serializeAttributes(SoapSerializer& pSZ)
  +{
  +	int iStatus= SUCCESS;
   
  -	if(m_pSoapMethod!=NULL) {
  -		m_strBodySerialized += m_pSoapMethod->serialize();
  -	} else if(m_pSoapFault!=NULL) {
  -		//m_strBodySerialized += "SOAP FAULT serialization";
  -		m_strBodySerialized += m_pSoapFault->serialize();
  -	}
  +	list<Attribute*>::iterator itCurrAttribute= m_attributes.begin();
   
  -	m_strBodySerialized += "</SOAP-ENV:Body>";
  +	while(itCurrAttribute != m_attributes.end()) {		
   
  -	return m_strBodySerialized;
  -}*/
  +		iStatus= (*itCurrAttribute)->serialize(pSZ);
  +		if(iStatus==FAIL) {
  +			break;
  +		}
  +		itCurrAttribute++;		
  +	}	
   
  -void SoapBody::addAttribute(Attribute *attr)
  -{
  -	m_attributes.push_back(attr);
  +	return iStatus;
   }
   
  +/*
  +comm on 10/07/2003 8.50pm
   int SoapBody::serializeAttributes(string &sSerialized)
   {
   	int iStatus= SUCCESS;
  @@ -170,3 +207,4 @@
   
   	return iStatus;
   }
  +*/
  
  
  
  1.4       +9 -8      xml-axis/c/src/soap/HeaderBlock.h
  
  Index: HeaderBlock.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/soap/HeaderBlock.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HeaderBlock.h	28 Jun 2003 05:18:21 -0000	1.3
  +++ HeaderBlock.h	15 Jul 2003 07:07:17 -0000	1.4
  @@ -107,12 +107,13 @@
   class HeaderBlock  
   {
   
  -private:
  -	int serializeChildren(string& sSerialized);
  +private:	
  +	int serializeChildren(SoapSerializer& pSZ);
  +	//int serializeChildren(string& sSerialized);
   	list<BasicNode*> m_children;
  -	bool isSerializable();
  -	//string attrSerialize();
  -	int attrSerialize(string&);
  +	bool isSerializable();		
  +	int attrSerialize(SoapSerializer& pSZ);
  +	//int attrSerialize(string&);
   	string m_localname;
   	string m_prefix;
   	string m_uri;
  @@ -121,9 +122,9 @@
   	//string m_strSerialized;
   
   public:
  -	int addChild(BasicNode* pBasicNode);
  -	//string& serialize();
  -	int serialize(string&);
  +	int addChild(BasicNode* pBasicNode);		
  +	int serialize(SoapSerializer& pSZ);
  +	//int serialize(string&);
   	void setValue(const string &value);
   	void addAttribute(Attribute* attr);
   	void setUri(const string &uri);
  
  
  
  1.2       +67 -37    xml-axis/c/src/soap/HeaderBlock.cpp
  
  Index: HeaderBlock.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/soap/HeaderBlock.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HeaderBlock.cpp	27 Jun 2003 04:34:58 -0000	1.1
  +++ HeaderBlock.cpp	15 Jul 2003 07:07:17 -0000	1.2
  @@ -66,6 +66,7 @@
   //////////////////////////////////////////////////////////////////////
   
   #include "HeaderBlock.h"
  +#include "SoapSerializer.h"
   #include "../common/GDefine.h"
   #include "BasicNode.h"
   
  @@ -116,7 +117,7 @@
   	m_value= value;
   }
   
  -int HeaderBlock::serialize(string& sSerialized)
  +int HeaderBlock::serialize(SoapSerializer& pSZ)
   {
   	/*
   	 *In the code we don't look whether the m_prefix is available or
  @@ -130,25 +131,22 @@
   	do {
   		if(isSerializable()) {
   
  -			sSerialized= sSerialized + "<" + m_prefix + ":" + m_localname +
  -								" xmlns:"+ m_prefix +"=\""+ m_uri+ "\"";
  +			pSZ<< "<" << m_prefix.c_str() << ":" << m_localname.c_str()
  +				<< " xmlns:"<< m_prefix.c_str() << "=\"" << m_uri.c_str() << "\"";
   
  -			iStatus= attrSerialize(sSerialized);
  +			iStatus= attrSerialize(pSZ);
   			if(iStatus==FAIL) {
   				break;
   			}
  +			
  +			pSZ<< ">";
   
  -			sSerialized= sSerialized + ">";
  -
  -			iStatus= serializeChildren(sSerialized);
  +			iStatus= serializeChildren(pSZ);
   			if(iStatus==FAIL) {
   				break;
   			}
   
  -			sSerialized= sSerialized + "</"+ m_prefix + ":"+ m_localname+ ">";
  -
  -		//	sSerialized= sSerialized + ">" + m_value + "</"+ m_prefix + 
  -		//			":"+ m_localname+ ">";
  +			pSZ<< "</" << m_prefix.c_str() << ":" << m_localname.c_str() << ">";
   			
   		} else {
   			iStatus= FAIL;
  @@ -158,8 +156,9 @@
   	return iStatus;
   }
   
  -/*string& HeaderBlock::serialize()
  -{*/
  +/*
  +int HeaderBlock::serialize(string& sSerialized)
  +{
   	/*
   	 *In the code we don't look whether the m_prefix is available or
   	 *	not. Instead directly insert it. The reason is that the SOAP
  @@ -167,27 +166,41 @@
   	 *  Header element MUST be namespace-qualified".
   	 */
   
  +	/*int iStatus= SUCCESS;
   
  -/*	m_strSerialized= "";
  +	do {
  +		if(isSerializable()) {
   
  -	if(isSerializable()) {
  -		string strAttrSerialized= attrSerialize();
  +			sSerialized= sSerialized + "<" + m_prefix + ":" + m_localname +
  +								" xmlns:"+ m_prefix +"=\""+ m_uri+ "\"";			
   
  -		m_strSerialized= "<" + m_prefix + ":" + m_localname + " xmlns:"+ m_prefix +
  -							"=\""+ m_uri+ "\"";
  +			iStatus= attrSerialize(sSerialized);
  +			if(iStatus==FAIL) {
  +				break;
  +			}
   
  -		if(!strAttrSerialized.empty()) {	//NOTE: check whether the list is empty
  -			m_strSerialized= m_strSerialized+ " "+ strAttrSerialized;		
  -		}
  +			sSerialized= sSerialized + ">";
   
  -		m_strSerialized= m_strSerialized + ">" + m_value + "</"+ m_prefix + 
  -				":"+ m_localname+ ">";
  -	}
  +			iStatus= serializeChildren(sSerialized);
  +			if(iStatus==FAIL) {
  +				break;
  +			}
   
  -	return m_strSerialized;
  -}*/
  +			sSerialized= sSerialized + "</"+ m_prefix + ":"+ m_localname+ ">";
   
  -int HeaderBlock::attrSerialize(string& sSerialized)
  +		//	sSerialized= sSerialized + ">" + m_value + "</"+ m_prefix + 
  +		//			":"+ m_localname+ ">";
  +			
  +		} else {
  +			iStatus= FAIL;
  +		}
  +	} while(0);
  +
  +	return iStatus;
  +}
  +*/
  +
  +int HeaderBlock::attrSerialize(SoapSerializer& pSZ)
   {
   	int iStatus= SUCCESS;
   
  @@ -195,7 +208,7 @@
   
   	while(itCurrAttribute != m_attributes.end()) {		
   
  -		iStatus= (*itCurrAttribute)->serialize(sSerialized);
  +		iStatus= (*itCurrAttribute)->serialize(pSZ);
   		if(iStatus==FAIL) {
   			break;
   		}
  @@ -205,24 +218,26 @@
   	return iStatus;
   }
   
  -/*string HeaderBlock::attrSerialize()
  +/*
  +comm on 10/7/2003 6.00pm
  +int HeaderBlock::attrSerialize(string& sSerialized)
   {
  -	string strAttrSerialized;
  +	int iStatus= SUCCESS;
   
   	list<Attribute*>::iterator itCurrAttribute= m_attributes.begin();
   
   	while(itCurrAttribute != m_attributes.end()) {		
   
  -		strAttrSerialized= strAttrSerialized+ (*itCurrAttribute)->serialize();
  -		itCurrAttribute++;
  -
  -		if(itCurrAttribute != m_attributes.end()) {
  -			strAttrSerialized= strAttrSerialized+ " ";
  +		iStatus= (*itCurrAttribute)->serialize(sSerialized);
  +		if(iStatus==FAIL) {
  +			break;
   		}
  +		itCurrAttribute++;		
   	}	
   
  -	return strAttrSerialized;
  -}*/
  +	return iStatus;
  +}
  +*/
   
   bool HeaderBlock::isSerializable()
   {
  @@ -256,6 +271,20 @@
   	return SUCCESS;
   }
   
  +int HeaderBlock::serializeChildren(SoapSerializer& pSZ)
  +{
  +	list<BasicNode*>::iterator itCurrBasicNode= m_children.begin();
  +
  +	while(itCurrBasicNode != m_children.end()) {		
  +		(*itCurrBasicNode)->serialize(pSZ);
  +		itCurrBasicNode++;		
  +	}	
  +
  +	return SUCCESS;
  +}
  +
  +/*
  +comm on 10/7/2003 6.00pm
   int HeaderBlock::serializeChildren(string &sSerialized)
   {
   	list<BasicNode*>::iterator itCurrBasicNode= m_children.begin();
  @@ -267,3 +296,4 @@
   
   	return SUCCESS;
   }
  +*/