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 su...@apache.org on 2003/12/12 14:49:20 UTC

cvs commit: ws-axis/c/src/soap SoapSerializer.cpp

susantha    2003/12/12 05:49:20

  Modified:    c/include/axis/client/transport/axis Tag:
                        Release-2003_10_26-bugfixes_branch
                        HttpTransport.hpp Receiver.hpp Transport.hpp
               c/src/client Tag: Release-2003_10_26-bugfixes_branch
                        Call.cpp
               c/src/client/transport/axis Tag:
                        Release-2003_10_26-bugfixes_branch
                        AxisTransport.cpp Channel.cpp HttpTransport.cpp
                        Receiver.cpp
               c/src/soap Tag: Release-2003_10_26-bugfixes_branch
                        SoapSerializer.cpp
  Log:
  Some transport layer bug fixes resulted when using the AxisInputSource functionality.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.2.2.1   +1 -1      ws-axis/c/include/axis/client/transport/axis/HttpTransport.hpp
  
  Index: HttpTransport.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/include/axis/client/transport/axis/HttpTransport.hpp,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- HttpTransport.hpp	23 Oct 2003 08:26:32 -0000	1.2
  +++ HttpTransport.hpp	12 Dec 2003 13:49:19 -0000	1.2.2.1
  @@ -110,7 +110,7 @@
   	void  SetProperty(const std::string& p_Property, const std::string& p_Value);
   
   	/// Read from a HTTP transport handler and store read payload
  -	const Transport& operator >> (std::string& p_Payload);
  +	const Transport& operator >> (const char** pPayload);
   
   	/// Write a given payload by using HTTP transport as carrier
   	const Transport& operator << (const std::string& p_Payload);
  
  
  
  1.2.2.1   +6 -3      ws-axis/c/include/axis/client/transport/axis/Receiver.hpp
  
  Index: Receiver.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/include/axis/client/transport/axis/Receiver.hpp,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- Receiver.hpp	23 Oct 2003 08:26:32 -0000	1.2
  +++ Receiver.hpp	12 Dec 2003 13:49:19 -0000	1.2.2.1
  @@ -73,17 +73,20 @@
   class Receiver  
   {
   public:
  -	Receiver(Transport *pTr) : repMsg(""), m_pTrChannel(pTr){}
  +	Receiver(Transport *pTr) : m_pMsg(NULL), m_MsgSize(0), m_BytesRead(0), m_pTrChannel(pTr){}
   	~Receiver();
   
  -	const std::string& Recv() throw (AxisException);
  +	const char* Recv(int nMaxToRead) throw (AxisException);
   
   private:
  -	std::string repMsg;
  +	const char* m_pMsg;
   
   	Transport *m_pTrChannel;
   
   	unsigned int m_RecvPort;
  +
  +	int m_MsgSize;
  +	int m_BytesRead;
   };
   
   #endif // _AXIS_RECEIVER_HPP
  
  
  
  1.2.2.1   +1 -1      ws-axis/c/include/axis/client/transport/axis/Transport.hpp
  
  Index: Transport.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/include/axis/client/transport/axis/Transport.hpp,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- Transport.hpp	23 Oct 2003 08:26:32 -0000	1.2
  +++ Transport.hpp	12 Dec 2003 13:49:19 -0000	1.2.2.1
  @@ -91,7 +91,7 @@
   	virtual void SetProperty(const std::string& p_Property, const std::string& p_Value){}
   
   
  -	virtual const Transport& operator >> (std::string& msg){return *this;}
  +	virtual const Transport& operator >> (const char** pMsg){*pMsg=NULL;return *this;}
   	virtual const Transport& operator << (const std::string& msg){return *this;}
       virtual void ClearAdditionalHeaders(){};
   
  
  
  
  No                   revision
  No                   revision
  1.20.2.3  +2 -0      ws-axis/c/src/client/Call.cpp
  
  Index: Call.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/client/Call.cpp,v
  retrieving revision 1.20.2.2
  retrieving revision 1.20.2.3
  diff -u -r1.20.2.2 -r1.20.2.3
  --- Call.cpp	27 Nov 2003 08:49:35 -0000	1.20.2.2
  +++ Call.cpp	12 Dec 2003 13:49:20 -0000	1.20.2.3
  @@ -81,6 +81,8 @@
   	m_pIWSDZ = NULL;
   	m_Soap.so.http.ip_headercount = 0;
   	m_Soap.so.http.ip_headers = NULL;
  +	m_Soap.so.http.op_headercount = 0;
  +	m_Soap.so.http.op_headers = NULL;
   	initialize_module(0);
   	m_pTransport = NULL;
   	m_nReturnType = XSD_UNKNOWN;
  
  
  
  No                   revision
  No                   revision
  1.9.2.3   +10 -8     ws-axis/c/src/client/transport/axis/AxisTransport.cpp
  
  Index: AxisTransport.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/client/transport/axis/AxisTransport.cpp,v
  retrieving revision 1.9.2.2
  retrieving revision 1.9.2.3
  diff -u -r1.9.2.2 -r1.9.2.3
  --- AxisTransport.cpp	27 Nov 2003 12:59:45 -0000	1.9.2.2
  +++ AxisTransport.cpp	12 Dec 2003 13:49:20 -0000	1.9.2.3
  @@ -141,11 +141,13 @@
   int AxisTransport::Get_bytes(char* pRecvBuffer, int nBuffSize, int* pRecvSize, const void* pStream)
   {
       Receiver* pReceiver = (Receiver*) pStream;
  -    const string& strReceive =  pReceiver->Recv();
  -    int nLen = strlen(strReceive.c_str());
  -    if(nLen < nBuffSize)
  -    {
  -        strcpy(pRecvBuffer, strReceive.c_str());
  +    const char* strReceive =  pReceiver->Recv(nBuffSize);
  +	int nLen;
  +	if (strReceive)
  +	{
  +		nLen = strlen(strReceive);
  +		nLen = (nLen < nBuffSize) ? nLen : nBuffSize; 
  +        strncpy(pRecvBuffer, strReceive, nLen);
           *pRecvSize = nLen;
           return AXIS_SUCCESS;
       }
  @@ -162,10 +164,10 @@
   		Sender* pSender = (Sender*) pSStream->str.op_stream;
   		if (!pSender) return AXIS_FAIL;
   		string sName, sValue;
  -		for (int x=0; x<pSStream->so.http.ip_headercount;x++)
  +		for (int x=0; x<pSStream->so.http.op_headercount;x++)
   		{
  -			sName = pSStream->so.http.ip_headers[x].headername;
  -			sValue = pSStream->so.http.ip_headers[x].headervalue;
  +			sName = pSStream->so.http.op_headers[x].headername;
  +			sValue = pSStream->so.http.op_headers[x].headervalue;
   			pSender->SetProperty(sName, sValue);
   		}
   		return AXIS_SUCCESS;
  
  
  
  1.2.2.1   +1 -0      ws-axis/c/src/client/transport/axis/Channel.cpp
  
  Index: Channel.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/client/transport/axis/Channel.cpp,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- Channel.cpp	20 Oct 2003 06:37:58 -0000	1.2
  +++ Channel.cpp	12 Dec 2003 13:49:20 -0000	1.2.2.1
  @@ -234,6 +234,7 @@
   
   const Channel& Channel::operator >> (std::string& msg)
   {
  +	msg = "";
   	if(INVALID_SOCKET == m_Sock) 
   	{
   		Error("Reading cannot be done without having a open socket.");
  
  
  
  1.7.2.1   +3 -3      ws-axis/c/src/client/transport/axis/HttpTransport.cpp
  
  Index: HttpTransport.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/client/transport/axis/HttpTransport.cpp,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- HttpTransport.cpp	20 Oct 2003 06:37:58 -0000	1.7
  +++ HttpTransport.cpp	12 Dec 2003 13:49:20 -0000	1.7.2.1
  @@ -134,13 +134,13 @@
    *
    */
   
  -const Transport& HttpTransport::operator >> (std::string& p_Payload)
  +const Transport& HttpTransport::operator >> (const char** pPayLoad)
   {
   	if(!m_bStatus) 
   	{
   		// We have the payload; this is due to Fault request made in earlier call 
   		// to this method
  -		p_Payload = m_PayLoad;
  +		*pPayLoad = m_PayLoad.c_str();
   		return *this;
   	}
   
  @@ -155,7 +155,7 @@
   	if(!m_bStatus) HTTPValidate(tmpPacket);
   
   	// At this point we have the payload at hand so give it out
  -	p_Payload = m_PayLoad;
  +	*pPayLoad = m_PayLoad.c_str();
   	return *this;
   }
   
  
  
  
  1.4.2.1   +30 -13    ws-axis/c/src/client/transport/axis/Receiver.cpp
  
  Index: Receiver.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/client/transport/axis/Receiver.cpp,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- Receiver.cpp	23 Oct 2003 08:24:59 -0000	1.4
  +++ Receiver.cpp	12 Dec 2003 13:49:20 -0000	1.4.2.1
  @@ -72,25 +72,42 @@
   
   }
   
  -const std::string& Receiver::Recv() throw (AxisException)
  +const char* Receiver::Recv(int nMaxToRead) throw (AxisException)
   {
  -	try
  +	const char* pToReturn = NULL;
  +
  +	if (0 == m_BytesRead)
   	{
  -		*m_pTrChannel >> repMsg;
  +		try
  +		{
  +			*m_pTrChannel >> (&m_pMsg);
  +			m_MsgSize = strlen(m_pMsg);
  +		}
  +		catch(AxisException& ex)
  +		{
  +			// Get the fault message.
  +			*m_pTrChannel >> (&m_pMsg);
  +			m_MsgSize = strlen(m_pMsg);
  +			#ifdef _DEBUG
  +			//	std::cerr << ex.GetErrorMsg() << std::endl;
  +			#endif
  +		}
  +		catch(...)
  +		{
  +			throw AxisException(RECEPTION_ERROR);
  +		}
   	}
  -	catch(AxisException& ex)
  +	if (m_MsgSize > 0)
   	{
  -		// Get the fault message.
  -		*m_pTrChannel >> repMsg;
  -		#ifdef _DEBUG
  -		//	std::cerr << ex.GetErrorMsg() << std::endl;
  -		#endif
  +		pToReturn = m_pMsg;
  +		m_BytesRead = (m_MsgSize < nMaxToRead) ? m_MsgSize : nMaxToRead;
  +		m_MsgSize -= m_BytesRead;
  +		m_pMsg += m_BytesRead;
  +		return pToReturn;		
   	}
  -	catch(...)
  +	else
   	{
  -		throw AxisException(RECEPTION_ERROR);
  +		return NULL;
   	}
  -
  -	return repMsg;
   }
   
  
  
  
  No                   revision
  No                   revision
  1.30.2.4  +2 -2      ws-axis/c/src/soap/SoapSerializer.cpp
  
  Index: SoapSerializer.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/SoapSerializer.cpp,v
  retrieving revision 1.30.2.3
  retrieving revision 1.30.2.4
  diff -u -r1.30.2.3 -r1.30.2.4
  --- SoapSerializer.cpp	12 Dec 2003 13:47:20 -0000	1.30.2.3
  +++ SoapSerializer.cpp	12 Dec 2003 13:49:20 -0000	1.30.2.4
  @@ -90,7 +90,7 @@
   	m_pSoapEnvelope = NULL;
   	m_iSoapVersion = SOAP_VER_1_1;
   	m_pOutputStream = NULL;
  -    m_cSerializedBuffer = malloc(INITIAL_SERIALIZE_BUFFER_SIZE);
  +    m_cSerializedBuffer = (char*) malloc(INITIAL_SERIALIZE_BUFFER_SIZE);
   	m_iCurrentSerBufferSize = 0;
       m_iBufferSize = INITIAL_SERIALIZE_BUFFER_SIZE;
   }
  @@ -376,7 +376,7 @@
   	if((m_iCurrentSerBufferSize + iTmpSerBufferSize)>= m_iBufferSize) 
   	{
           m_iBufferSize *= 2;
  -        m_cSerializedBuffer = realloc(m_cSerializedBuffer, m_iBufferSize);
  +        m_cSerializedBuffer = (char*) realloc(m_cSerializedBuffer, m_iBufferSize);
   	}    
   	strcat(m_cSerializedBuffer, cSerialized);
   	m_iCurrentSerBufferSize += iTmpSerBufferSize;