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 da...@apache.org on 2004/01/12 06:24:20 UTC

cvs commit: ws-axis/c/src/client/transport/axis AxisTransport.cpp Channel.cpp HttpTransport.cpp Receiver.cpp

damitha     2004/01/11 21:24:20

  Modified:    c/include/axis/client/transport/axis HttpTransport.hpp
                        Receiver.hpp Transport.hpp
               c/src/client/transport/axis AxisTransport.cpp Channel.cpp
                        HttpTransport.cpp Receiver.cpp
  Log:
  Applied client side modifications present in bugfixes branch.
  
  Revision  Changes    Path
  1.3       +7 -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.3
  diff -u -r1.2 -r1.3
  --- HttpTransport.hpp	23 Oct 2003 08:26:32 -0000	1.2
  +++ HttpTransport.hpp	12 Jan 2004 05:24:20 -0000	1.3
  @@ -110,10 +110,13 @@
   	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);
  +    int getBodyLength();
  +    void setBodyLength(int bodyLength);    
  +    int getIsHttpHeader();
   
   private:
   	/// Build a HTTP packet with a given payload & additional HTTP properties
  @@ -143,6 +146,9 @@
   	Header_t	m_AdditionalHeader; ///< Additional Header fields as name value pairs
   private:
   	Channel m_Channel;
  +    int m_IsHttpHeader;
  +    std::string m_sHeader;
  +    int m_intBodyLength;
   };
   
   #endif //_AXIS_HTTPTRANSPORT_HPP
  
  
  
  1.3       +7 -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.3
  diff -u -r1.2 -r1.3
  --- Receiver.hpp	23 Oct 2003 08:26:32 -0000	1.2
  +++ Receiver.hpp	12 Jan 2004 05:24:20 -0000	1.3
  @@ -73,17 +73,21 @@
   class Receiver  
   {
   public:
  -	Receiver(Transport *pTr) : repMsg(""), m_pTrChannel(pTr){}
  +	Receiver(Transport *pTr) : m_pMsg(NULL), m_pTrChannel(pTr){}
   	~Receiver();
   
  -	const std::string& Recv() throw (AxisException);
  +	const char* Recv(int nMaxToRead) throw (AxisException);
  +    int getBytesRead();
   
   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.3       +4 -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.3
  diff -u -r1.2 -r1.3
  --- Transport.hpp	23 Oct 2003 08:26:32 -0000	1.2
  +++ Transport.hpp	12 Jan 2004 05:24:20 -0000	1.3
  @@ -91,9 +91,12 @@
   	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(){};
  +    virtual int getBodyLength() = 0;
  +    virtual void setBodyLength(int bodyLength) = 0;
  +    virtual int getIsHttpHeader() = 0;
   
   
   protected:
  
  
  
  1.11      +82 -12    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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AxisTransport.cpp	21 Nov 2003 12:56:00 -0000	1.10
  +++ AxisTransport.cpp	12 Jan 2004 05:24:20 -0000	1.11
  @@ -65,6 +65,9 @@
   #include <axis/client/transport/AxisTransport.h>
   #include <axis/client/transport/axis/TransportFactory.hpp>
   
  +#define READCHUNCKSIZE 1024
  +#define RECVPACKETSIZE 1024
  +
   AxisTransport::AxisTransport(Ax_soapstream* pSoap)
   {
       m_pSoap = pSoap;
  @@ -86,7 +89,7 @@
   int AxisTransport::OpenConnection()
   {
       //Step 1 - Open Transport layer connection taking into account protocol and endpoint URI in m_Soap
  -    Url objUrl(m_pSoap->so.http.uri_path);
  +    Url objUrl(m_pSoap->so.http->uri_path);
       m_pHttpTransport = TransportFactory::GetTransport(objUrl);
       if(m_pHttpTransport->Init())
       {
  @@ -99,9 +102,16 @@
          //Step 3 - Add function pointers to the m_Soap structure
          m_pSoap->transport.pGetFunct = Get_bytes;
          m_pSoap->transport.pSendFunct = Send_bytes;
  +/*<<<<<<< AxisTransport.cpp
          m_pSoap->transport.pGetTrtFunct = Receive_transport_information;
          m_pSoap->transport.pSendTrtFunct = Send_transport_information; 
   	   return AXIS_SUCCESS;
  +=======*/
  +       m_pSoap->transport.pGetTrtFunct = ReceiveTransportInformation;
  +       m_pSoap->transport.pSetTrtFunct = SetTransportInformation; 
  +	   m_pSoap->transport.pRelBufFunct = ReleaseReceiveBuffer;
  +	   return AXIS_SUCCESS;
  +//>>>>>>> 1.9.4.4
       }
       else
   	{
  @@ -126,20 +136,27 @@
   	m_pSoap->transport.pGetFunct = NULL;
   	m_pSoap->transport.pSendFunct = NULL;
   	m_pSoap->transport.pGetTrtFunct = NULL;
  -	m_pSoap->transport.pSendTrtFunct = NULL;
  +	m_pSoap->transport.pSetTrtFunct = NULL;
   }
   
  -int AxisTransport::Send_bytes(const char* pSendBuffer, const void* pStream)
  +AXIS_TRANSPORT_STATUS AXISCALL AxisTransport::Send_bytes(const char* pSendBuffer, const void* bufferid, const void* pSStream)
   {
  -    Sender* pSender = (Sender*) pStream;
  +	Ax_soapstream* pStream = (Ax_soapstream*) pSStream;
  +    Sender* pSender = (Sender*)(pStream->str.op_stream);
       if(pSender->Send(pSendBuffer))
  +/*<<<<<<< AxisTransport.cpp
           return AXIS_SUCCESS;
       return AXIS_FAIL;
       
  +=======*/
  +        return TRANSPORT_FINISHED;
  +    return TRANSPORT_FAILED;
  +//>>>>>>> 1.9.4.4
   }
   
  -int AxisTransport::Get_bytes(char* pRecvBuffer, int nBuffSize, int* pRecvSize, const void* pStream)
  +AXIS_TRANSPORT_STATUS AXISCALL AxisTransport::Get_bytes(const char** res, int* retsize, const void* pSStream)
   {
  +/*<<<<<<< AxisTransport.cpp
       Receiver* pReceiver = (Receiver*) pStream;
       const string& strReceive =  pReceiver->Recv();
       int nLen = strlen(strReceive.c_str());
  @@ -152,28 +169,81 @@
       else
           return AXIS_FAIL;
       
  +=======*/
  +	Ax_soapstream* pStream = (Ax_soapstream*) pSStream;
  +    Receiver* pReceiver = (Receiver*) pStream->str.ip_stream;
  +    const char* strReceive =  pReceiver->Recv(RECVPACKETSIZE);
  +	if (strReceive)
  +	{
  +		*res = strReceive;
  +		*retsize = strlen(strReceive);
  +		return TRANSPORT_IN_PROGRESS;
  +	}
  +	else
  +	{
  +		*res = NULL;
  +		*retsize = 0;
  +		return TRANSPORT_FINISHED;
  +	}
  +//>>>>>>> 1.9.4.4
   }
   
  -int AxisTransport::Send_transport_information(void* pSoapStream)
  +void AXISCALL AxisTransport::SetTransportInformation(AXIS_TRANSPORT_INFORMATION_TYPE type, const char* value, const void* pSStream)
   {
  -    Ax_soapstream* pSStream = (Ax_soapstream*) pSoapStream;
  -	if (pSStream)
  +	Ax_soapstream* pStream = (Ax_soapstream*) pSStream;
  +	const char* key = NULL;
  +	switch(type)
   	{
  +/*<<<<<<< AxisTransport.cpp
   		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++)
  +=======*/
  +	case SOAPACTION_HEADER:
  +		key = "SOAPAction";
  +		break;
  +	case SERVICE_URI: /* need to set ? */
  +		break;
  +	case OPERATION_NAME: /* need to set ? */
  +		break;
  +	case SOAP_MESSAGE_LENGTH: 
  +		key = "Content-Length"; //this Axis transport is http so the key
  +		break;
  +	default:;
  +	}
  +
  +	if (!key) return;
  +	
  +	if (pStream)
  +	{
  +		Sender* pSender = (Sender*) pStream->str.op_stream;
  +		if (pSender)
  +//>>>>>>> 1.9.4.4
   		{
  -			sName = pSStream->so.http.ip_headers[x].headername;
  -			sValue = pSStream->so.http.ip_headers[x].headervalue;
  -			pSender->SetProperty(sName, sValue);
  +			pSender->SetProperty(key, value);
   		}
  +/*<<<<<<< AxisTransport.cpp
   		return AXIS_SUCCESS;
  +=======*/
  +//>>>>>>> 1.9.4.4
   	}
  +/*<<<<<<< AxisTransport.cpp
   	return AXIS_FAIL;
  +=======*/
  +//>>>>>>> 1.9.4.4
   }
   
  -int AxisTransport::Receive_transport_information(void* pSoapStream)
  +const char* AXISCALL AxisTransport::ReceiveTransportInformation(AXIS_TRANSPORT_INFORMATION_TYPE type, const void* pSStream)
   {
  +/*<<<<<<< AxisTransport.cpp
   	return AXIS_SUCCESS;
  +=======*/
  +	return NULL;
  +}
  +
  +void AXISCALL AxisTransport::ReleaseReceiveBuffer(const char* buffer, const void* pSStream)
  +{
  +
  +//>>>>>>> 1.9.4.4
   }
  
  
  
  1.3       +16 -20    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.3
  diff -u -r1.2 -r1.3
  --- Channel.cpp	20 Oct 2003 06:37:58 -0000	1.2
  +++ Channel.cpp	12 Jan 2004 05:24:20 -0000	1.3
  @@ -59,6 +59,7 @@
    *
    *
    * @author Lilantha Darshana (lilantha@virtusa.com)
  + * @author Damitha Kumarage (damitha@jkcsworld.com, damitha@opensource.lk)
    *
    */
   
  @@ -98,13 +99,12 @@
   {
   	m_RemoteNode = p_RemoteNode;
   	m_RemoteEnd  = p_RemoteEnd;
  -
  +    //printf("open a new connection\n");
   	if(!Init())
   		throw ChannelException("Cannot initialize a channel to the remote end");
   
   	sockaddr_in clAddr, svAddr;			  
  -
  -	if ((m_Sock = socket(PF_INET, SOCK_STREAM, 0)) != INVALID_SOCKET)
  +	if ((m_Sock = socket(AF_INET, SOCK_STREAM, 0)) != INVALID_SOCKET)
   	{
   		clAddr.sin_family = AF_INET;     // AF_INET (address family Internet).
   		clAddr.sin_port   = 0; 			 // No Specify Port required
  @@ -229,11 +229,12 @@
   /**
    * Read/receive a message from the remote server; reading may be done in chunks.
    *
  - * @param	string to hold the read Message 
  + * @param	string to hold the read data chunk
    */
   
   const Channel& Channel::operator >> (std::string& msg)
   {
  +	msg = "";
   	if(INVALID_SOCKET == m_Sock) 
   	{
   		Error("Reading cannot be done without having a open socket.");
  @@ -241,31 +242,26 @@
   	}
   
   	int nByteRecv = 0;
  -	const int BUF_SIZE = 4096;
  +	const int BUF_SIZE = 512;
   	char buf[BUF_SIZE];
  -	
  -	do	// Manage multiple chuncks of the message
  -	{
  +  
   		if ((nByteRecv = recv(m_Sock, (char *) &buf, BUF_SIZE - 1, 0)) == SOCKET_ERROR)
   		{
  +            perror("recv SOCKET_ERROR");
   			Error("Channel error while getting data.");
  -			CloseChannel();
  -			throw ChannelException("Input streaming error on Channel while getting data");
  +			//CloseChannel();
  +            return *this;
  +			//throw ChannelException("Input streaming error on Channel while getting data");
   		}
  -
   		if(nByteRecv)
   		{
  -			buf[nByteRecv + 1] = '\0';	// got a part of the message, so add it to form 
  -			msg += buf;					// the whole message
  -
  -			//Validate according to the transport; check whether we are in a position to return.
  -			if (!m_pTransportHandler->GetStatus(msg)) 
  -				break;
  +            //printf("if(nByteRecv)\n");
  +			buf[nByteRecv] = '\0';	// got a part of the message, so add it to form 
  +            msg = buf;
  +            //printf("buf:%s\n", buf);
   		}
   		else
  -			break; // we have the whole message or an error has occured
  -	 }
  -	 while (true);
  +            printf("execution break\n");
   
   	 return *this;
   }
  
  
  
  1.8       +95 -32    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.8
  diff -u -r1.7 -r1.8
  --- HttpTransport.cpp	20 Oct 2003 06:37:58 -0000	1.7
  +++ HttpTransport.cpp	12 Jan 2004 05:24:20 -0000	1.8
  @@ -61,6 +61,7 @@
    *
    *
    * @author Lilantha Darshana (lilantha@virtusa.com)
  + * @author Damitha Kumarage (damitha@jkcsworld.com, damitha@opensource.lk)
    *
    */
   
  @@ -134,28 +135,61 @@
    *
    */
   
  -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;
   	}
   
   	std::string tmpPacket;	// use temporary, need to workout for this
  -	m_Channel >> tmpPacket;
  +  if(m_IsHttpHeader == 1)
  +  {
  +      //printf("m_IsHttpHeader == 1\n");
  +	     m_Channel >> tmpPacket;
  +      *pPayLoad = tmpPacket.c_str();
  +      
  +      return *this;
  +  }
  +  //printf("tmpPacket:%s\n", tmpPacket.c_str());
       
   #ifdef _DEBUG
   	std::cout << "\n\n\nGot the message:\r\n\r\n" << tmpPacket << "\n\n";
   #endif
  -	
  -	// Validate the HTTP packet
  -	if(!m_bStatus) HTTPValidate(tmpPacket);
  -
  -	// At this point we have the payload at hand so give it out
  -	p_Payload = m_PayLoad;
  +    do //process will step into this only if http validation is not done. That is, until the stream
  +      //contain the httpd header.
  +    {
  +        m_Channel >> tmpPacket;
  +        
  +        // Validate the HTTP packet
  +        if(m_IsHttpHeader == 1) //if header is validated but payload has zero length, process will steop into this.
  +        {
  +            //printf("while,m_IsHttpHeader == 1\n");
  +            *pPayLoad = tmpPacket.c_str();
  +            
  +            break;
  +        }
  +        //printf("do while\n"); 
  +        if(m_bStatus) HTTPValidate(tmpPacket); //Validate the header
  +        int j = strlen(tmpPacket.c_str());
  +        if(j == 0)
  +            break;
  +        *pPayLoad = m_PayLoad.c_str();
  +        int i = strlen(m_PayLoad.c_str());
  +        //printf("i:%d\n", i);
  +        //If payload has nonzero length
  +        if(i > 0)
  +        {
  +            //printf("if i> 0\n");
  +            break;
  +        }
  +  } while(true);
  +  
  +  	
   	return *this;
   }
   
  @@ -245,13 +279,22 @@
   	// for the time being just get the payload. Here we need much work
   
   	m_bStatus = true;
  -	std::string::size_type pos = p_HttpPacket.find('\n'), nxtpos;
  -
  -	int nHttpSatus;
  -
  -	if(pos == std::string::npos) return; //unexpected string
  -
  -	std::string strLine = p_HttpPacket.substr(0, pos + 1);
  +  int nHttpSatus;
  +  
  +  m_sHeader +=  p_HttpPacket;
  +  
  +  //printf("m_sHeader:%s\n", m_sHeader.c_str());
  +  std::string::size_type pos, nxtpos;
  +	pos = p_HttpPacket.find("\r\n\r\n");
  +	if(pos == std::string::npos)
  +  {
  +    m_PayLoad = "";
  +    return; //unexpected string
  +  }
  +
  +  m_IsHttpHeader = 1; //We have the stream until payload
  +  pos = m_sHeader.find('\n');    
  +	std::string strLine = m_sHeader.substr(0, pos + 1);
   	std::string::size_type offset = pos + 1;
   
   	// Check for HTTP header validity; HTTP 1.0 / HTTP 1.0 is supported.
  @@ -273,27 +316,28 @@
   		// Status code is 2xx; so valid packet. hence go ahead and extract the payload.
   		if(nHttpSatus == 2)
   		{
  -			GetPayLoad(p_HttpPacket, offset);
  +            //printf("nHttpSatus is 2\n");
  +			GetPayLoad(m_sHeader, offset);
   		}
   		else if(nHttpSatus == 3)	// Status code is 3xx; some error has occurred
   		{
   			// error recovery mechanism should go here
  -			Error(p_HttpPacket.c_str());
  +			Error(m_sHeader.c_str());
   			throw ChannelException("HTTP Error, cannot process response message...");
   		}
   		else if(nHttpSatus == 4)	// Status code is 4xx; some error has occurred
   		{
   			// error recovery mechanism should go here
  -			Error(p_HttpPacket.c_str());
  +			Error(m_sHeader.c_str());
   			throw ChannelException("HTTP Error, cannot process response message...");
   		}
   		else if(nHttpSatus == 5)	// Status code is 5xx; some error has occurred
   		{
   			// error recovery mechanism should go here
  -			GetPayLoad(p_HttpPacket, offset);
  +			GetPayLoad(m_sHeader, offset);
   			if (!m_bStatus) 
   			{
  -				Error(p_HttpPacket.c_str());
  +				Error(m_sHeader.c_str());
   				throw AxisException(HTTP_ERROR);
   			}
   		}
  @@ -313,7 +357,7 @@
   {
   	std::string::size_type pos, nxtpos;
   	std::string strLine;
  -	int len=0;
  +	//int len=0;
   
   	// process rest of the HTTP packet
   	while (true)
  @@ -328,24 +372,27 @@
   
   		// Get the payload size from the header.
   		if((pos = strLine.find("Content-Length:")) != std::string::npos) 
  -			len = atoi(strLine.substr(pos + strlen("Content-Length: ")).c_str());
  +			m_intBodyLength = atoi(strLine.substr(pos + strlen("Content-Length: ")).c_str());
  +      //printf("m_intBodyLength:%d\n", m_intBodyLength);
   	}
   
   	m_PayLoad = p_HttpPacket.substr(offset);
  +    //printf("m_PayLoad:%s\n", m_PayLoad.c_str());
  +  
   
  -	pos = m_PayLoad.rfind('0');
  +	//pos = m_PayLoad.rfind('0');
   
  -	if(std::string::npos != pos && m_PayLoad[pos+1] != '\"')
  -	{
  +	//if(std::string::npos != pos && m_PayLoad[pos+1] != '\"')
  +	//{
   		//nxtpos = m_PayLoad.find("1df");
   		//if(std::string::npos != nxtpos && '\n' == m_PayLoad[nxtpos+4])
  -		{
  -			m_bStatus = false; // we have the payload
  +		//{
  +			//m_bStatus = false; // we have the payload
   			// Extract the SOAP message
  -			m_PayLoad = m_PayLoad.substr(m_PayLoad.find('<'));
  -			m_PayLoad = m_PayLoad.substr(0, m_PayLoad.rfind('>') + 1);
  -		}
  -	}
  +			//m_PayLoad = m_PayLoad.substr(m_PayLoad.find('<'));
  +			//m_PayLoad = m_PayLoad.substr(0, m_PayLoad.rfind('>') + 1);
  +		//}
  +	//}
   
   #ifdef _DEBUG
   	std::cout << "Payload:\n" << m_PayLoad << std::endl;
  @@ -370,3 +417,19 @@
   {
       m_AdditionalHeader.clear();
   }
  +
  +int HttpTransport::getBodyLength()
  +{
  +  return m_intBodyLength;
  +}
  +
  +void HttpTransport::setBodyLength(int bodyLength)
  +{
  +  m_intBodyLength = bodyLength;
  +  
  +}
  +
  +int HttpTransport::getIsHttpHeader()
  +{
  +  return m_IsHttpHeader;
  +}
  \ No newline at end of file
  
  
  
  1.5       +59 -12    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.5
  diff -u -r1.4 -r1.5
  --- Receiver.cpp	23 Oct 2003 08:24:59 -0000	1.4
  +++ Receiver.cpp	12 Jan 2004 05:24:20 -0000	1.5
  @@ -59,11 +59,13 @@
    *
    *
    * @author Lilantha Darshana (lilantha@virtusa.com)
  + * @author Damitha Kumarage (damitha@jkcsworld.com, damitha@opensource.lk)
    *
    */
   
   #include <axis/client/transport/axis/Platform.hpp>
   #include <axis/client/transport/axis/Receiver.hpp>
  +#include <axis/client/transport/axis/HttpTransport.hpp>
   #include <iostream>
   
   
  @@ -72,25 +74,70 @@
   
   }
   
  -const std::string& Receiver::Recv() throw (AxisException)
  +const char* Receiver::Recv(int nMaxToRead) throw (AxisException)
   {
  -	try
  +  int bodyLength;
  +  int isHttpHeader;
  +	const char* pToReturn = NULL;
  +  isHttpHeader = m_pTrChannel->getIsHttpHeader();
  +  bodyLength = m_pTrChannel->getBodyLength();
  +  //printf("bodyLength:%d\n", bodyLength);
  +  //printf("isHttpHeader:%d\n", isHttpHeader);
  +  if(isHttpHeader == 1 && bodyLength == 0)
  +    return NULL;
  +	if (0 == m_BytesRead)
   	{
  -		*m_pTrChannel >> repMsg;
  +		try
  +		{
  +            //printf("try\n");
  +			*m_pTrChannel >> (&m_pMsg);
  +            if(m_pMsg == NULL)
  +                return NULL;
  +            
  +			m_MsgSize = strlen(m_pMsg);        
  +		}
  +		catch(AxisException& ex)
  +		{
  +      printf("catch\n");
  +			// Get the fault message.
  +			*m_pTrChannel >> (&m_pMsg);
  +			m_MsgSize = strlen(m_pMsg);
  +			#ifdef _DEBUG
  +			//	std::cerr << ex.GetErrorMsg() << std::endl;
  +			#endif
  +		}
  +		catch(...)
  +		{
  +      printf("catch(...)\n");
  +			throw AxisException(RECEPTION_ERROR);
  +		}
   	}
  -	catch(AxisException& ex)
  +    //printf("m_MsgSize:%d\n", m_MsgSize);
  +	if (m_MsgSize > 0)
   	{
  -		// Get the fault message.
  -		*m_pTrChannel >> repMsg;
  -		#ifdef _DEBUG
  -		//	std::cerr << ex.GetErrorMsg() << std::endl;
  -		#endif
  +    bodyLength = m_pTrChannel->getBodyLength();
  +    //printf("m_MsgSize:%d\n", m_MsgSize);
  +    //printf("bodyLength:%d\n", bodyLength);
  +    bodyLength -= m_MsgSize;
  +    m_pTrChannel->setBodyLength(bodyLength);    
  +		pToReturn = m_pMsg;
  +		m_BytesRead = (m_MsgSize < nMaxToRead) ? m_MsgSize : nMaxToRead;
  +        //printf("m_BytesRead:%d\n", m_BytesRead);
  +		m_MsgSize -= m_BytesRead;
  +		m_pMsg += m_BytesRead;
  +    m_BytesRead = 0;
  +    
  +		return pToReturn;		
   	}
  -	catch(...)
  +	else
   	{
  -		throw AxisException(RECEPTION_ERROR);
  +        printf("m_MsgSize == 0, so return NULL\n");
  +		return NULL;
   	}
  +}
   
  -	return repMsg;
  +int Receiver::getBytesRead()
  +{
  +  return m_BytesRead;
   }