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/03/31 15:51:15 UTC

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

damitha     2004/03/31 05:51:15

  Modified:    c/src/transport/axis AxisTransport.cpp Channel.cpp
                        Receiver.cpp
  Log:
  
  
  Revision  Changes    Path
  1.20      +5 -2      ws-axis/c/src/transport/axis/AxisTransport.cpp
  
  Index: AxisTransport.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/transport/axis/AxisTransport.cpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- AxisTransport.cpp	27 Mar 2004 15:06:36 -0000	1.19
  +++ AxisTransport.cpp	31 Mar 2004 13:51:15 -0000	1.20
  @@ -168,7 +168,7 @@
   		{
   			if(!m_SendBuffers[index].buffer) break;
   			else
  -			{
  +			{	
   				if(!m_pSender->Send(m_SendBuffers[index].buffer))
   				/* some error occured in the transport */
   				{
  @@ -210,15 +210,18 @@
   
   AXIS_TRANSPORT_STATUS AxisTransport::Get_bytes(const char** res, int* retsize, const void* pSStream)
   {
  -    const char* strReceive =  m_pReceiver->Recv();
  +    	const char* strReceive =  m_pReceiver->Recv();
  +	printf("strReceive:%s\n", strReceive);
   	if (strReceive)
   	{
  +		printf("came\n");
   		*res = strReceive;
   		*retsize = strlen(strReceive);
   		return TRANSPORT_IN_PROGRESS;
   	}
   	else
   	{
  +		printf("came2\n");
   		*res = NULL;
   		*retsize = 0;
   		return TRANSPORT_FINISHED;
  
  
  
  1.11      +22 -19    ws-axis/c/src/transport/axis/Channel.cpp
  
  Index: Channel.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/transport/axis/Channel.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Channel.cpp	27 Mar 2004 15:06:36 -0000	1.10
  +++ Channel.cpp	31 Mar 2004 13:51:15 -0000	1.11
  @@ -236,34 +236,37 @@
   
   const Channel& Channel::operator >> (std::string& msg)
   {
  -        msg = "";
  +	msg = "";
           if(INVALID_SOCKET == m_Sock)
           {
                   Error("Reading cannot be done without having a open socket.");
  -                throw ChannelException("Input streaming error on undefined channel; please open the channel first");
  +                throw ChannelException("Input streaming error on " \
  +		"undefined channel; please open the channel first");
           }
   
           int nByteRecv = 0;
           const int BUF_SIZE = 512;
           char buf[BUF_SIZE];
   
  -                if ((nByteRecv = recv(m_Sock, (char *) &buf, BUF_SIZE - 1, 0)) == SOCKET_ERROR)
  -                {
  -            perror("recv SOCKET_ERROR");
  -                        Error("Channel error while getting data.");
  -                        //CloseChannel();
  -            return *this;
  -                        //throw ChannelException("Input streaming error on Channel while getting data");
  -                }
  -                if(nByteRecv)
  -                {
  -            //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
  -            printf("execution break\n");
  +        if ((nByteRecv = recv(m_Sock, (char *) &buf, BUF_SIZE - 1, 0)) 
  +		== SOCKET_ERROR)
  +        {
  +        	perror("recv SOCKET_ERROR");
  +                Error("Channel error while getting data.");
  +                //CloseChannel();
  +            	return *this;
  +                //throw ChannelException("Input streaming error on Channel " \
  +		//"while getting data");
  +	}
  +        if(nByteRecv)
  +        {
  +		printf("nByteRecv:%d\n", nByteRecv);
  +                buf[nByteRecv] = '\0';  // got a part of the message, so add " \		"to form
  +            	msg = buf;
  +            	//printf("buf:%s\n", buf);
  +	}
  +        else
  +        	printf("execution break\n");
   
            return *this;
   }
  
  
  
  1.12      +25 -23    ws-axis/c/src/transport/axis/Receiver.cpp
  
  Index: Receiver.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/transport/axis/Receiver.cpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Receiver.cpp	27 Mar 2004 15:06:36 -0000	1.11
  +++ Receiver.cpp	31 Mar 2004 13:51:15 -0000	1.12
  @@ -76,29 +76,31 @@
   
   const char* Receiver::Recv() throw (AxisException)
   {
  -  int bodyLength;
  -  int isHttpHeader;
  +  	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;
  +  	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)
   	{
   		try
   		{
  -            //printf("try\n");
  +            		printf("try\n");
   			*m_pTrChannel >> (&m_pMsg);
  -            if(m_pMsg == NULL)
  -                return NULL;
  -            
  +            		if(m_pMsg == NULL)
  +			{
  +				printf("m_pMsg==NULL\n");
  +                		return NULL;
  +			}
   			m_MsgSize = strlen(m_pMsg);        
   		}
   		catch(AxisException& ex)
   		{
  -      printf("catch\n");
  +      			printf("catch\n");
   			// Get the fault message.
   			*m_pTrChannel >> (&m_pMsg);
   			m_MsgSize = strlen(m_pMsg);
  @@ -108,30 +110,30 @@
   		}
   		catch(...)
   		{
  -      printf("catch(...)\n");
  +      			printf("catch(...)\n");
   			throw AxisException(RECEPTION_ERROR);
   		}
   	}
  -    //printf("m_MsgSize:%d\n", m_MsgSize);
  +    	//printf("m_MsgSize:%d\n", m_MsgSize);
   	if (m_MsgSize > 0)
   	{
  -    bodyLength = m_pTrChannel->getBodyLength();
  -    //printf("m_MsgSize:%d\n", m_MsgSize);
  -    //printf("bodyLength:%d\n", bodyLength);
  -    bodyLength -= m_MsgSize;
  -    m_pTrChannel->setBodyLength(bodyLength);    
  +    		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;
  -        //printf("m_BytesRead:%d\n", m_BytesRead);
  +        	printf("m_BytesRead:%d\n", m_BytesRead);
   		m_MsgSize -= m_BytesRead;
   		m_pMsg += m_BytesRead;
  -    m_BytesRead = 0;
  +    		m_BytesRead = 0;
       
   		return pToReturn;		
   	}
   	else
   	{
  -        printf("m_MsgSize == 0, so return NULL\n");
  +        	printf("m_MsgSize == 0, so return NULL\n");
   		return NULL;
   	}
   }