axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject cvs commit: ws-axis/c/src/soap SoapBinInputStream.cpp
Date Tue, 06 Jan 2004 07:46:40 GMT
damitha     2004/01/05 23:46:40

  Modified:    c/docs/linux Tag: Release-2003_10_26-bugfixes_branch
                        lininstall-guide.html
               c/include/axis/client/transport Tag:
                        Release-2003_10_26-bugfixes_branch AxisTransport.h
               c/include/axis/client/transport/axis Tag:
                        Release-2003_10_26-bugfixes_branch Channel.hpp
                        HttpTransport.hpp Receiver.hpp Transport.hpp
               c/include/axis/common Tag:
                        Release-2003_10_26-bugfixes_branch AxisTrace.h
                        AxisUserAPI.h
               c/samples/client/interoptests/base Tag:
                        Release-2003_10_26-bugfixes_branch
                        InteropBaseClient.cpp
               c/src/client/transport/axis Tag:
                        Release-2003_10_26-bugfixes_branch
                        AxisTransport.cpp Channel.cpp HttpTransport.cpp
                        Receiver.cpp Transport.cpp
               c/src/soap Tag: Release-2003_10_26-bugfixes_branch
                        SoapBinInputStream.cpp
  Log:
  Did some major changes to client side transport layer. Earlier in Channel.cpp, socket method
  recv is called in a do while loop and the received buffer is accumulated into a string which
is
  passed into the parser in full. This model fails sadly for large array size in echoStringArray
method of interopbase/base sample. The change I made is to pass the buffer received from recv
method without accumulating into the parser.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.3   +12 -11    ws-axis/c/docs/linux/Attic/lininstall-guide.html
  
  Index: lininstall-guide.html
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/docs/linux/Attic/lininstall-guide.html,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- lininstall-guide.html	30 Nov 2003 10:41:36 -0000	1.1.2.2
  +++ lininstall-guide.html	6 Jan 2004 07:46:39 -0000	1.1.2.3
  @@ -339,20 +339,21 @@
   </div>
   <p>We tested with the following</p>
   <ul>
  -<li>Redhat Linux 8.0(2.4.18-14), RedhatLinux9.0(2.4.20-8), mandrake8.0(2.4.8-26)
</li>
  -<li>Apache 1.3 [apache_1.3.27.tar .gz, apache_1.3.28.tar.gz)], (Source), apache2.0
(source)</li>
  +<li>Redhat Linux 8.0(2.4.18-14), RedhatLinux9.0(2.4.20-8), Mandrake8.0(2.4.8-26)
</li>
  +<li>Apache 1.3 [apache_1.3.27.tar .gz, apache_1.3.28.tar.gz)], (Source), Apache2.0
(source)</li>
   
   <li>Xerces C++ [xerces-c-src2_2_0.tar.gz](Source) &gt;(Source)</li>
   </ul>
   <p>
  -<strong>Getting the source or binary from the mirror site and setting the environment
variables</strong>
  +<strong>Downloading the source or binary from the mirror site and setting the environment
variables</strong>
   </p>
  -<p>User can download the Axis C++ source or binary from one of the apache mirror
sites</p>
  -<p>Your downloaded distribution is axis-c-src-beta-linux.tar.gz. After you extracting
it for example as, <strong>/home/axisuser/projects/axis-c-src-beta-linux</strong>
you can rename it as <strong>axis_c</strong>
  +<p>You can download the Axis C++ source or binary from one of the apache mirror sites
  +<a href="http://ws.apache.org/axis/cpp/download.html">http://ws.apache.org/axis/cpp/download.html</a></p>
  +<p>Your downloaded distribution is axis-c-src-1_0-linux.tar.gz. After you extracting
it for example as, <strong>/home/axisuser/projects/axis-c-src-1_0-linux</strong>
you can rename it as <strong>axis_c</strong>
   </p>
   
  -<p>The directory where you extracted the tar ball will be called &lt;axiscpphome&gt;
from now on. We further assume that the user dose the installation and has the linux user
account axisuser. For example I have my &lt;axiscpphome&gt; as following.</p>
  -<p>/home/axisuser/projects</p>
  +<p>You have to set the environment variable $AXISCPP_HOME to the directory where
you extracted the tar ball. We further assume that the user dose the installation and has
the linux user account axisuser. For example I have my &lt;AXISCPP_HOME&gt; as following.</p>
  +<p>/home/axisuser/projects/axis_c</p>
   <p>
   <a name="Installing"></a>
   </p>
  @@ -374,7 +375,7 @@
   <strong>$ ./configure --enable-module=so</strong>
   
   </p>
  -<p>Note:- Here "so" are simple letters</p>
  +<p>Note:- Here "so" is simple letters</p>
   <p>
   <strong>$ make</strong>
   </p>
  @@ -487,7 +488,7 @@
   <p>
   -----------------------------------------------------------------
   </p>
  -<p>Now libaxiscpp_mod.so (in apache2 this is libaxiscpp_mod2.so) should have been
created in $AXISCPP_HOME/bin directory. Note:- you can give the install path inside the runconfigure
script.There will be link errors if you don't use correct version of xerces-c.</p>
  +<p>Now libaxiscpp_mod.so (If you built for apache2 this is libaxiscpp_mod2.so) should
have been created in $AXISCPP_HOME/bin directory. Note:- you can give the install path inside
the runconfigure script.There will be link errors if you don't use correct version of xerces-c.</p>
   <p>Now you need to edit /usr/local/apache/conf/httpd.conf</p>
   <p>
   <strong>$ vi /usr/local/apache/conf/httpd.conf</strong>
  @@ -506,9 +507,9 @@
   <p>
   <strong>&lt;/Location&gt;</strong>
   </p>
  -<p>Copy /home/axisuser/projects/axis_c/bin/libaxiscpp_mod.so into /usr/local/Apache/libexec/
(in apache2 replace libexec with modules and libaxiscpp_mod.so with libaxiscpp_mod2.so)</p>
  +<p>Copy $AXISCPP_HOME/bin/libaxiscpp_mod.so into /usr/local/Apache/libexec/ (in apache2
replace libexec with modules and libaxiscpp_mod.so with libaxiscpp_mod2.so)</p>
   <p>
  -<strong>$cp -f /home/axisuser/projects/axis_c/bin/libaxiscpp_mod.so /usr/local/apache/libexec
(in apache2 replace libexec with modules and libaxiscpp_mod.so with libaxiscpp_mod2.so)</strong>
  +<strong>$cp -f $AXISCPP_HOME/bin/libaxiscpp_mod.so /usr/local/apache/libexec (in
apache2 replace libexec with modules and libaxiscpp_mod.so with libaxiscpp_mod2.so)</strong>
   </p>
   <p>Restart apache</p>
   
  
  
  
  No                   revision
  No                   revision
  1.2.2.2   +1 -1      ws-axis/c/include/axis/client/transport/AxisTransport.h
  
  Index: AxisTransport.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/include/axis/client/transport/AxisTransport.h,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- AxisTransport.h	27 Nov 2003 12:59:43 -0000	1.2.2.1
  +++ AxisTransport.h	6 Jan 2004 07:46:39 -0000	1.2.2.2
  @@ -67,7 +67,7 @@
       @brief api for the client transport layer
   
   
  -    @author Damitha Kumarage (damitha@opensource.lk)
  +    @author Damitha Kumarage (damitha@jkcsworld.com, damitha@opensource.lk)
       @author Susantha Kumara (susantha@opensource.lk, skumara@virtusa.com)    
   */
   class AxisTransport
  
  
  
  No                   revision
  No                   revision
  1.2.2.2   +2 -2      ws-axis/c/include/axis/client/transport/axis/Channel.hpp
  
  Index: Channel.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/include/axis/client/transport/axis/Channel.hpp,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- Channel.hpp	5 Jan 2004 04:42:45 -0000	1.2.2.1
  +++ Channel.hpp	6 Jan 2004 07:46:39 -0000	1.2.2.2
  @@ -59,6 +59,7 @@
    *
    *
    * @author Lilantha Darshana (lilantha@virtusa.com)
  + * @author Damitha Kumarage (damitha@jkcsworld.com, damitha@opensource.lk)
    *
    */
   
  @@ -68,7 +69,6 @@
   #include <string>
   #include "Transport.hpp"
   
  -#define AXIS_TRANSPORT_BUF_SIZE 512
   // platform specific stuff
   
   #ifdef WIN32
  @@ -175,8 +175,8 @@
   	std::string		m_RemoteNode;		///< Remote address could be IP/host-name
   	unsigned short	m_RemoteEnd;		///< Remote port number
   	std::string		m_LastErr;			///< Last error as a string 
  +
   	Transport	* m_pTransportHandler;	///< Transport handler for validation purpose
  -	static char m_buf[AXIS_TRANSPORT_BUF_SIZE]; //Assuming this transport is used only by
a single thread.
   };
   
   
  
  
  
  1.2.2.3   +10 -2     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.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- HttpTransport.hpp	1 Jan 2004 12:15:15 -0000	1.2.2.2
  +++ HttpTransport.hpp	6 Jan 2004 07:46:39 -0000	1.2.2.3
  @@ -59,6 +59,7 @@
    *
    *
    * @author Lilantha Darshana (lilantha@virtusa.com)
  + * @author Damitha Kumarage (damitha@jkcsworld.com, damitha@opensource.lk)
    *
    */
   
  @@ -91,10 +92,10 @@
   	enum Type{POST, MPOST};
   
   	/// Create HTTP transport with provided URL as remote address, set HTTP category default
to POST
  -	HttpTransport(Url url) : m_Typ(POST) {m_Url = url; m_Length = 0;}
  +	HttpTransport(Url url) : m_Typ(POST) {m_Url = url; m_IsHttpHeader = 0;}
   
   	/// Create HTTP transport with provided remote address as URL-string, set HTTP category
default to POST
  -	HttpTransport(std::string& strUrl) : m_Typ(POST) {m_Url = Url(strUrl); m_strUrl =
strUrl; m_Length = 0;}
  +	HttpTransport(std::string& strUrl) : m_Typ(POST) {m_Url = Url(strUrl); m_strUrl =
strUrl; m_IsHttpHeader = 0;}
   	~HttpTransport();
   
   	/// Initialize HTTP transport by establishing a channel to the remote end.
  @@ -114,6 +115,9 @@
   
   	/// 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
  @@ -139,9 +143,13 @@
   	std::ostringstream m_OutMsg;	///< Holds	outgoing HTTP packet
   	std::istringstream m_InMsg;		///< Holds	incoming HTTP packet
   
  +	std::string m_PayLoad;			///< Holds the payload
   	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.2.2.2   +2 -0      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.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- Receiver.hpp	12 Dec 2003 13:49:19 -0000	1.2.2.1
  +++ Receiver.hpp	6 Jan 2004 07:46:39 -0000	1.2.2.2
  @@ -59,6 +59,7 @@
    *
    *
    * @author Lilantha Darshana (lilantha@virtusa.com)
  + * @author Damitha Kumarage (damitha@jkcsworld.com, damitha@opensource.lk)
    *
    */
   
  @@ -77,6 +78,7 @@
   	~Receiver();
   
   	const char* Recv(int nMaxToRead) throw (AxisException);
  +  int getBytesRead();
   
   private:
   	const char* m_pMsg;
  
  
  
  1.2.2.3   +7 -4      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.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- Transport.hpp	1 Jan 2004 12:15:15 -0000	1.2.2.2
  +++ Transport.hpp	6 Jan 2004 07:46:39 -0000	1.2.2.3
  @@ -59,6 +59,7 @@
    *
    *
    * @author Lilantha Darshana (lilantha@virtusa.com)
  + * @author Damitha Kumarage (damitha@jkcsworld.com, damitha@opensource.lk)
    *
    */
   
  @@ -93,16 +94,18 @@
   
   	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 void ClearAdditionalHeaders(){};
  +  virtual int getBodyLength() = 0;
  +  virtual void setBodyLength(int bodyLength) = 0;
  +  virtual int getIsHttpHeader() = 0;
   
   
   protected:
  +
   	Url m_Url;
   	std::string m_strUrl;           
   	bool m_bStatus;
  -public:
  -	int m_Length;
  -	std::string m_PayLoad;			///< Holds the payload
  +
   };
   
   #endif // _AXIS_TRANSPORT_HPP
  
  
  
  No                   revision
  No                   revision
  1.4.2.8   +1 -1      ws-axis/c/include/axis/common/AxisTrace.h
  
  Index: AxisTrace.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/include/axis/common/AxisTrace.h,v
  retrieving revision 1.4.2.7
  retrieving revision 1.4.2.8
  diff -u -r1.4.2.7 -r1.4.2.8
  --- AxisTrace.h	17 Dec 2003 05:56:55 -0000	1.4.2.7
  +++ AxisTrace.h	6 Jan 2004 07:46:40 -0000	1.4.2.8
  @@ -64,7 +64,7 @@
   #include <string>
   #include <stdio.h>
   
  -//#define __AXISTRACE__
  +#define __AXISTRACE__
   #if defined(__AXISTRACE__)  
     #define AXISTRACE1(X, Y) g_pAT->logaxis(X,Y,__FILE__,__LINE__);
     #define AXISTRACE2(X,Y, Z) g_pAT->logaxis(X,Y,Z,__FILE__,__LINE__);
  
  
  
  1.2.2.3   +1 -1      ws-axis/c/include/axis/common/AxisUserAPI.h
  
  Index: AxisUserAPI.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/include/axis/common/AxisUserAPI.h,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- AxisUserAPI.h	28 Nov 2003 09:46:03 -0000	1.2.2.2
  +++ AxisUserAPI.h	6 Jan 2004 07:46:40 -0000	1.2.2.3
  @@ -70,7 +70,7 @@
   	int m_Size;
   } Axis_Array;
   
  -typedef struct tm Axis_Time;
  +//typedef struct tm Axis_Time;
   typedef struct tm Axis_Date;
   typedef struct tm Axis_DateTime;
   typedef double Axis_Decimal;
  
  
  
  No                   revision
  No                   revision
  1.1.2.2   +12 -5     ws-axis/c/samples/client/interoptests/base/Attic/InteropBaseClient.cpp
  
  Index: InteropBaseClient.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/samples/client/interoptests/base/Attic/InteropBaseClient.cpp,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- InteropBaseClient.cpp	28 Nov 2003 05:30:32 -0000	1.1.2.1
  +++ InteropBaseClient.cpp	6 Jan 2004 07:46:40 -0000	1.1.2.2
  @@ -19,9 +19,10 @@
   		printf("failed\n");
   	// testing echoStringArray
   	ArrayOfstring arrstr;
  -	arrstr.m_Array = new string[ARRAYSIZE];
  -	arrstr.m_Size = ARRAYSIZE;
  -	for (x=0;x<ARRAYSIZE;x++)
  +	int temp = 3500;
  +	arrstr.m_Array = new string[temp];
  +	arrstr.m_Size = temp;
  +	for (x=0;x<temp;x++)
   	{
   		sprintf(buffer, "%dth element of string array", x);
   		arrstr.m_Array[x] = buffer;
  @@ -32,7 +33,7 @@
   	else
   		printf("failed\n");
   	// testing echoInteger
  -	printf("invoking echoInteger...\n");
  +/*	printf("invoking echoInteger...\n");
   	if (ws.echoInteger(56) == 56)
   		printf("successful\n");
   	else
  @@ -109,9 +110,14 @@
   		printf("failed\n");
   	time_t tim;
   	time(&tim);
  -	tm* lt = gmtime(&tim);
  +    //tm* lt = gmtime(&tim);
  +	tm* lt = localtime(&tim);
   	printf("invoking echoDate...\n");
  +    //tm lt2 = ws.echoDate(*lt);
  +    //printf("year:%d\n", lt2.tm_year);
  +    //printf("month:%d\n", lt2.tm_mon);
   	if (memcmp(&ws.echoDate(*lt), lt, sizeof(tm)) == 0)
  +    //if(memcmp(&lt2, lt, sizeof(tm)) == 0)
   		printf("successful\n");
   	else
   		printf("failed\n");
  @@ -134,6 +140,7 @@
   		printf("successful\n");
   	else
   		printf("failed\n");
  +*/
   	getchar();
   	return 0;
   }
  
  
  
  No                   revision
  No                   revision
  1.9.2.4   +16 -11    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.3
  retrieving revision 1.9.2.4
  diff -u -r1.9.2.3 -r1.9.2.4
  --- AxisTransport.cpp	12 Dec 2003 13:49:20 -0000	1.9.2.3
  +++ AxisTransport.cpp	6 Jan 2004 07:46:40 -0000	1.9.2.4
  @@ -54,7 +54,7 @@
    */
    /**
    *
  - * @author Damitha Kumarage (damitha@opensource.lk, damitha@jkcsworld.com)
  + * @author Damitha Kumarage (damitha@jkcsworld.com, damitha@opensource.lk)
    * @author Susantha Kumara (susantha@opensource.lk, skumara@virtusa.com)
    *
    */
  @@ -140,19 +140,23 @@
   
   int AxisTransport::Get_bytes(char* pRecvBuffer, int nBuffSize, int* pRecvSize, const void*
pStream)
   {
  -    Receiver* pReceiver = (Receiver*) pStream;
  -    const char* strReceive =  pReceiver->Recv(nBuffSize);
  -	int nLen;
  -	if (strReceive)
  +  Receiver* pReceiver = (Receiver*) pStream;
  +  const char* strReceive =  pReceiver->Recv(nBuffSize);
  +  int nLen;
  +  if (strReceive)
   	{
  +        //printf("strReceive:%s\n", strReceive);
   		nLen = strlen(strReceive);
   		nLen = (nLen < nBuffSize) ? nLen : nBuffSize; 
  -        strncpy(pRecvBuffer, strReceive, nLen);
  -        *pRecvSize = nLen;
  -        return AXIS_SUCCESS;
  -    }
  -    else
  -        return AXIS_FAIL;
  +    strncpy(pRecvBuffer, strReceive, nLen);
  +    *pRecvSize = nLen;
  +    //printf("nLen:%d\n", nLen);    
  +    return AXIS_SUCCESS;
  +  }
  +  else
  +  {
  +    return AXIS_FAIL;
  +  }
       
   }
   
  @@ -179,3 +183,4 @@
   {
   	return AXIS_SUCCESS;
   }
  +
  
  
  
  1.2.2.4   +18 -50    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.2.3
  retrieving revision 1.2.2.4
  diff -u -r1.2.2.3 -r1.2.2.4
  --- Channel.cpp	5 Jan 2004 04:42:45 -0000	1.2.2.3
  +++ Channel.cpp	6 Jan 2004 07:46:40 -0000	1.2.2.4
  @@ -59,6 +59,7 @@
    *
    *
    * @author Lilantha Darshana (lilantha@virtusa.com)
  + * @author Damitha Kumarage (damitha@jkcsworld.com, damitha@opensource.lk)
    *
    */
   
  @@ -68,7 +69,6 @@
   #include <axis/client/transport/axis/Transport.hpp>
   
   using namespace std;
  -char Channel::m_buf[AXIS_TRANSPORT_BUF_SIZE];
   /**
    * Create a Channel & initialize
    * 
  @@ -99,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
  @@ -230,7 +229,7 @@
   /**
    * 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)
  @@ -242,60 +241,29 @@
   		throw ChannelException("Input streaming error on undefined channel; please open the channel
first");
   	}
   
  -	int nToRead;
   	int nByteRecv = 0;
  -	
  -	// read socket until we reach to the body
  -	do	// Manage multiple chuncks of the message
  -	{
  -		if ((nByteRecv = recv(m_Sock, (char *) &m_buf, AXIS_TRANSPORT_BUF_SIZE - 1, 0)) ==
SOCKET_ERROR)
  +	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();
  -			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)
   		{
  -			m_buf[nByteRecv] = '\0';	// got a part of the message, so add it to form 
  -			msg += m_buf;					// the whole message
  -
  +            //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
  -			return *this;
  -
  -	 }
  -	 while (msg.find("\r\n\r\n") == std::string::npos);
  -	 if (!m_pTransportHandler->GetStatus(msg)) 
  -	 {
  -		 msg = "";
  -		 return *this;
  -	 }
  -
  -	nToRead = m_pTransportHandler->m_Length - m_pTransportHandler->m_PayLoad.length();
  -
  -	do	// Manage multiple chuncks of the message
  -	{
  -		if ((nByteRecv = recv(m_Sock, (char *) &m_buf, AXIS_TRANSPORT_BUF_SIZE - 1, 0)) ==
SOCKET_ERROR)
  -		{
  -			Error("Channel error while getting data.");
  -			CloseChannel();
  -			throw ChannelException("Input streaming error on Channel while getting data");
  -		}
  -		
  -		if(nByteRecv)
  -		{
  -			nToRead -= nByteRecv;
  -			m_buf[nByteRecv] = '\0';	// got a part of the message, so add it to form 
  -			m_pTransportHandler->m_PayLoad += m_buf;					// the whole message
  +            printf("execution break\n");
   
  -		}
  -		else
  -			break; // we have the whole message or an error has occured
  -	 }
  -	 while (nToRead > 0);
  -	//Validate according to the transport; check whether we are in a position to return.
  -	return *this;
  +	 return *this;
   }
   
   /**
  
  
  
  1.7.2.3   +95 -29    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.2.2
  retrieving revision 1.7.2.3
  diff -u -r1.7.2.2 -r1.7.2.3
  --- HttpTransport.cpp	1 Jan 2004 12:15:16 -0000	1.7.2.2
  +++ HttpTransport.cpp	6 Jan 2004 07:46:40 -0000	1.7.2.3
  @@ -61,6 +61,7 @@
    *
    *
    * @author Lilantha Darshana (lilantha@virtusa.com)
  + * @author Damitha Kumarage (damitha@jkcsworld.com, damitha@opensource.lk)
    *
    */
   
  @@ -141,21 +142,54 @@
   		// We have the payload; this is due to Fault request made in earlier call 
   		// to this method
   		*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
  -	*pPayLoad = m_PayLoad.c_str();
  +    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,8 @@
   {
   	std::string::size_type pos, nxtpos;
   	std::string strLine;
  -	m_Length=0;
  +	//int len=0;
  +
   	// process rest of the HTTP packet
   	while (true)
   	{
  @@ -327,23 +372,28 @@
   
   		// Get the payload size from the header.
   		if((pos = strLine.find("Content-Length:")) != std::string::npos) 
  -			m_Length = 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
   			// 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;
   #endif
  @@ -367,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.4.2.2   +31 -2     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.2.1
  retrieving revision 1.4.2.2
  diff -u -r1.4.2.1 -r1.4.2.2
  --- Receiver.cpp	12 Dec 2003 13:49:20 -0000	1.4.2.1
  +++ Receiver.cpp	6 Jan 2004 07:46:40 -0000	1.4.2.2
  @@ -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>
   
   
  @@ -74,17 +76,28 @@
   
   const char* Receiver::Recv(int nMaxToRead) throw (AxisException)
   {
  +  int bodyLength;
  +  int isHttpHeader;
   	const char* pToReturn = NULL;
  -
  +  isHttpHeader = m_pTrChannel->getIsHttpHeader();
  +  bodyLength = m_pTrChannel->getBodyLength();
  +  //printf("isHttpHeader:%d\n", isHttpHeader);
  +  if(isHttpHeader == 1 && bodyLength == 0)
  +    return "";
   	if (0 == m_BytesRead)
   	{
   		try
   		{
  +            //printf("try\n");
   			*m_pTrChannel >> (&m_pMsg);
  -			m_MsgSize = strlen(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);
  @@ -94,20 +107,36 @@
   		}
   		catch(...)
   		{
  +      printf("catch(...)\n");
   			throw AxisException(RECEPTION_ERROR);
   		}
   	}
  +    //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);    
   		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;		
   	}
   	else
   	{
  +        printf("m_MsgSize == 0, so return NULL\n");
   		return NULL;
   	}
  +}
  +
  +int Receiver::getBytesRead()
  +{
  +  return m_BytesRead;
   }
   
  
  
  
  1.3.2.1   +2 -0      ws-axis/c/src/client/transport/axis/Transport.cpp
  
  Index: Transport.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/client/transport/axis/Transport.cpp,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- Transport.cpp	20 Oct 2003 06:37:58 -0000	1.3
  +++ Transport.cpp	6 Jan 2004 07:46:40 -0000	1.3.2.1
  @@ -75,3 +75,5 @@
   
   }
   
  +
  +
  
  
  
  No                   revision
  No                   revision
  1.1.2.3   +1 -0      ws-axis/c/src/soap/Attic/SoapBinInputStream.cpp
  
  Index: SoapBinInputStream.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/Attic/SoapBinInputStream.cpp,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- SoapBinInputStream.cpp	12 Dec 2003 13:47:20 -0000	1.1.2.2
  +++ SoapBinInputStream.cpp	6 Jan 2004 07:46:40 -0000	1.1.2.3
  @@ -32,5 +32,6 @@
   {
   	int nRead = 0;
   	m_pReadFunct((char*)toFill, maxToRead, &nRead, m_pContext);
  +    
   	return nRead;
   }
  
  
  

Mime
View raw message