axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From susan...@apache.org
Subject cvs commit: ws-axis/c/src/soap SoapDeSerializer.cpp SoapSerializer.cpp
Date Fri, 12 Dec 2003 15:10:09 GMT
susantha    2003/12/12 07:10:09

  Modified:    c/include/axis/common Tag: CWrapperSupport Packet.h
               c/include/axis/soap Tag: CWrapperSupport SoapSerializer.h
               c/src/common Tag: CWrapperSupport AxisConfig.cpp
               c/src/soap Tag: CWrapperSupport SoapDeSerializer.cpp
                        SoapSerializer.cpp
  Log:
  Some changes for Asynchronous Transport module support
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.4.4   +90 -28    ws-axis/c/include/axis/common/Packet.h
  
  Index: Packet.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/include/axis/common/Packet.h,v
  retrieving revision 1.1.4.3
  retrieving revision 1.1.4.4
  diff -u -r1.1.4.3 -r1.1.4.4
  --- Packet.h	4 Dec 2003 05:37:38 -0000	1.1.4.3
  +++ Packet.h	12 Dec 2003 15:10:09 -0000	1.1.4.4
  @@ -111,24 +111,77 @@
   	Ax_stream_smtp smtp;
   } Ax_soapcontent;
   
  +typedef enum
  +{
  +	TRANSPORT_FINISHED=0,
  +	TRANSPORT_IN_PROGRESS,
  +	TRANSPORT_FAILED
  +} AXIS_TRANSPORT_STATUS;
  +
  +/**
  + * Function pointer definitions for axis trasport module call backs 
  + */
  +
  +/**
  + * This function is provided by the transport modules. Called by Axis engine when it needs
to send SOAP
  + * message. This function may be called several times.
  + * @return
  + *	TRANSPORT_FINISHED - Transport done and buffer is free to re-use.
  + *  TRANSPORT_IN_PROGRESS - Transport is in progress and buffer cannot be re-used yet.
  + *  TRANSPORT_FAILED - Transport has failed and no use of trying to send any more bytes.
Better to abort.
  + */
  +typedef AXIS_TRANSPORT_STATUS (AXISCALL * AXIS_MODULE_CALLBACK_SEND_MESSAGE_BYTES)(const
char*, const void*);
  +
  +/**
  + * This function is provided by the transport modules. Called by Axis engine when it needs
to get SOAP
  + * message. This function may be called several times.
  + * @return
  + *	TRANSPORT_FINISHED - No any more message bytes to be received. If a buffer is present
it is the last
  + *						 buffer.
  + *  TRANSPORT_IN_PROGRESS - There may be more message bytes to be received. Axis Engine
may call this 
  + *							function again to get any subsequent message buffers. Buffer should be present.
  + *  TRANSPORT_FAILED - Transport has failed and no use of trying to get any more bytes.
Better to abort.
  + */
  +typedef AXIS_TRANSPORT_STATUS (AXISCALL * AXIS_MODULE_CALLBACK_GET_MESSAGE_BYTES)(const
char**, int*, const void*);
  +/**
  + * This function is provided by the transport modules. Called by Axis engine when it needs
to say the
  + * transport module that the engine is no longer using the buffer and can be re-used.
  + */
  +typedef void (AXISCALL * AXIS_MODULE_CALLBACK_RELEASE_RECEIVE_BUFFER)(const char*, const
void*);
  +/**
  + * This function is provided by the transport modules. Called by Axis engine when it needs
to send any
  + * transport information such as http headers. This function can be called only once.
  + */
  +typedef int (AXISCALL * AXIS_MODULE_CALLBACK_SEND_TRANSPORT_INFORMATION)(void*); /*Ax_soapstream*/
  +/**
  + * This function is provided by the transport modules. Called by Axis engine when it needs
to get any
  + * transport information such as http headers. This function can be called only once.
  + */
  +typedef int (AXISCALL * AXIS_MODULE_CALLBACK_GET_TRANSPORT_INFORMATION)(void*);/*Ax_soapstream*/
  +
  +/**
  + * Function pointer definitions for axis call backs 
  + */
  +
   /**
  - *Function pointer definitions for trasport layer
  + * This function is provided by the Axis Engine. Called by transport module when it needs
to say that
  + * a message buffer passed to is is no longer being used by the transpor and can be re-used
by the 
  + * Axis engine.This function should be called for each buffer if AXIS_MODULE_CALLBACK_SEND_MESSAGE_BYTES
  + * returned TRANSPORT_IN_PROGRESS.
    */
  -typedef int (*AXIS_SEND_SEND_BYTES)(const char*, const void*);
  -typedef int (*AXIS_GET_BYTES)(const char**, int*, const void*);
  -typedef int (*AXIS_SEND_TRANSPORT_INFORMATION)(void*); /*Ax_soapstream*/
  -typedef int (*AXIS_GET_TRANSPORT_INFORMATION)(void*);/*Ax_soapstream*/
  +typedef void (AXISCALL * AXIS_ENGINE_CALLBACK_RELEASE_SEND_BUFFER)(const char*, const void*);
   
   /**
  - *Each transport module on the server side should populate following struct with 
  - *their transport function pointers in order for the Axis Engine to work properly.
  + * Each transport module on the server side should populate following struct with 
  + * their transport function pointers in order for the Axis Engine to work properly.
    */
   typedef struct
   {
  -	AXIS_SEND_SEND_BYTES pSendFunct;
  -	AXIS_GET_BYTES pGetFunct;
  -	AXIS_SEND_TRANSPORT_INFORMATION pSendTrtFunct;
  -	AXIS_GET_TRANSPORT_INFORMATION pGetTrtFunct;
  +	AXIS_MODULE_CALLBACK_SEND_MESSAGE_BYTES pSendFunct;
  +	AXIS_MODULE_CALLBACK_GET_MESSAGE_BYTES pGetFunct;
  +	AXIS_MODULE_CALLBACK_RELEASE_RECEIVE_BUFFER pRelBufFunct;
  +	AXIS_MODULE_CALLBACK_SEND_TRANSPORT_INFORMATION pSendTrtFunct;
  +	AXIS_MODULE_CALLBACK_GET_TRANSPORT_INFORMATION pGetTrtFunct;
   } Ax_transport;
   
   typedef struct
  @@ -157,27 +210,36 @@
   extern "C"
   {
   #endif
  -	/*This function is implemented in axis*/
  -	int uninitialize_module();
  -
  -	/*This function is implemented in axis*/
  -	int initialize_module(int bServer);
  -
  -	/*This function is implemented in axis*/
  -	int process_request(Ax_soapstream* str);
  +/**
  + * This function is implemented in axis and should be called ONCE to uninitialize Axis
Engine when the 
  + * Axis SOAP processor shuts down.
  + */
  +int uninitialize_module();
   
  -	/*This function should be implemented by module authors*/
  -	/*Allows to send pieces of soap response the transport handler*/
  -	/*int send_response_bytes(const char* res, const void* opstream);*/
  +/**
  + * This function is implemented in axis and should be called ONCE to initialize Axis Engine.
  + */
  +int initialize_module(int bServer);
   
  -	/*This function should be implemented by module authors*/
  -	/*Allows axis to get pieces of the request as they come to the transport listener*/
  -	/*int get_request_bytes(char* req, int reqsize, int* retsize, const void* ipstream);*/
  +/**
  + * This callback function is implemented in axis and should be called by the transport
module in order to
  + * start processing a SOAP message. 
  + * @param 
  + *		str - contains information about the SOAP stream and the message. This also should
be populated with
  + *			  the trasport module's callback functions.
  + */
  +int process_request(Ax_soapstream* str);
   
  -	/*This fucntion should be implemented by module authors*/
  -	/*int send_transport_information(Ax_soapstream *str);*/
  +/**
  + * This callback function is implemented in axis and should be called by the transport
module. 
  + * @param 
  + *		buffer - Buffer passed to transport by calling transport's AXIS_MODULE_CALLBACK_SEND_MESSAGE_BYTES

  + *				 callback
  + *		pContext - Context object passed to transport by calling transport's AXIS_MODULE_CALLBACK_SEND_MESSAGE_BYTES

  + *				 callback
  + */
  + int axis_buffer_release(const char* buffer, const void* pContext);
   
  -	/*int receive_transport_information(Ax_soapstream *str);*/
   #ifdef __cplusplus
   }
   #endif
  
  
  
  No                   revision
  No                   revision
  1.3.4.4   +20 -6     ws-axis/c/include/axis/soap/SoapSerializer.h
  
  Index: SoapSerializer.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/include/axis/soap/SoapSerializer.h,v
  retrieving revision 1.3.4.3
  retrieving revision 1.3.4.4
  diff -u -r1.3.4.3 -r1.3.4.4
  --- SoapSerializer.h	19 Nov 2003 13:49:54 -0000	1.3.4.3
  +++ SoapSerializer.h	12 Dec 2003 15:10:09 -0000	1.3.4.4
  @@ -75,9 +75,6 @@
   #include "../common/Packet.h"
   #include "SoapEnvVersions.h"
   
  -
  -#define SERIALIZE_BUFFER_SIZE 8192
  -
   class SoapEnvelope;
   class SoapHeader;
   class SoapMethod;
  @@ -85,15 +82,31 @@
   class SoapFault;
   class HeaderBlock;
   
  -class SoapSerializer : public IHandlerSoapSerializer /*: public ISoapSerializer*/
  +class SoapSerializer : public IHandlerSoapSerializer
   {
  +	typedef struct SerializeBuffersTag
  +	{
  +		volatile unsigned char inuse;
  +		volatile char* buffer;
  +	} SerializeBuffers;
   private:
   	int iCounter;
   	AxisChar cCounter[64];
   	SoapEnvelope* m_pSoapEnvelope;	
   	int m_iSoapVersion;
  -	char m_cSerializedBuffer[SERIALIZE_BUFFER_SIZE];
  -	int m_iCurrentSerBufferSize;
  +
  +	/* Table that keeps all allocated buffers */
  +	volatile SerializeBuffers* m_SZBuffers;
  +	/* Size of the initial buffer created.*/
  +	int m_nInitialBufferSize;
  +	/* Size of the m_SZBuffers array.*/
  +	int m_nMaxBuffersToCreate;
  +	/* Maximum size of the buffer that is being filled */
  +	int m_nCurrentBufferSize;
  +	/* How much charators has been filled to the currently selected buffer */
  +	int m_nFilledSize;
  +	/* Currently selected buffer index*/
  +	int m_nCurrentBufferIndex;
   public:
   	int AXISCALL createSoapMethod(const AxisChar* sLocalName, const AxisChar* sPrefix, const
AxisChar* sURI);	
   //	IWrapperSoapSerializer& operator<<(const char* cSerialized);
  @@ -135,6 +148,7 @@
   private:
   	int AddOutputParamHelper(const AxisChar* pchName, XSDTYPE nType, uParamValue Value);
   	int flushSerializedBuffer();
  +	int SetNextSerilizeBuffer()
   	IArrayBean* makeArrayBean(XSDTYPE nType, void* pArray);
   	IArrayBean* makeArrayBean(void* pObject, void* pSZFunct, void* pDelFunct, void* pSizeFunct);
   
  
  
  
  No                   revision
  No                   revision
  1.8.4.2   +4 -2      ws-axis/c/src/common/AxisConfig.cpp
  
  Index: AxisConfig.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/common/AxisConfig.cpp,v
  retrieving revision 1.8.4.1
  retrieving revision 1.8.4.2
  diff -u -r1.8.4.1 -r1.8.4.2
  --- AxisConfig.cpp	21 Nov 2003 12:48:08 -0000	1.8.4.1
  +++ AxisConfig.cpp	12 Dec 2003 15:10:09 -0000	1.8.4.2
  @@ -85,7 +85,8 @@
   	char value[CONFBUFFSIZE] = {0};
   
   	sConfPath = getenv("AXIS_HOME");
  -	if (!sConfPath) return AXIS_FAIL;
  +	if (!sConfPath) 
  +		return AXIS_FAIL;
   	strcpy(sNewConfPath, sConfPath);
       strcat(sNewConfPath, "/axiscpp.conf");
       if ((fileConfig = fopen(sNewConfPath, "rt")) == NULL)
  @@ -94,6 +95,7 @@
       while(fgets(line, CONFBUFFSIZE, fileConfig) != NULL)
       {
           int k=0;
  +		AxisUtils::clearArray(key, CONFBUFFSIZE);
           while(line[k] != ':')
           {
               key[k]=line[k];
  @@ -108,7 +110,7 @@
   		 */
   		AxisUtils::clearArray(value, CONFBUFFSIZE);
   
  -        while(line[k] != '\n')
  +        while((line[k] != '\n') && (line[k]!='\0'))
           {
               value[j]=line[k];
               k += 1;
  
  
  
  No                   revision
  No                   revision
  1.17.4.8  +1 -0      ws-axis/c/src/soap/SoapDeSerializer.cpp
  
  Index: SoapDeSerializer.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/SoapDeSerializer.cpp,v
  retrieving revision 1.17.4.7
  retrieving revision 1.17.4.8
  diff -u -r1.17.4.7 -r1.17.4.8
  --- SoapDeSerializer.cpp	11 Dec 2003 04:29:57 -0000	1.17.4.7
  +++ SoapDeSerializer.cpp	12 Dec 2003 15:10:09 -0000	1.17.4.8
  @@ -103,6 +103,7 @@
   			m_pInputStream->transport.pGetFunct(&m_pCurrentBuffer, &nChars, m_pInputStream->str.ip_stream);
   			if ((nChars > 0) && m_pCurrentBuffer)
   				m_pParser->Parse(m_pCurrentBuffer, nChars);
  +			m_pInputStream->transport.pRelBufFunct(m_pCurrentBuffer, m_pInputStream->str.ip_stream);
   		} while (nChars > 0);
   		m_pParser->ParseEnd();
   	}
  
  
  
  1.30.4.6  +76 -21    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.4.5
  retrieving revision 1.30.4.6
  diff -u -r1.30.4.5 -r1.30.4.6
  --- SoapSerializer.cpp	21 Nov 2003 12:48:11 -0000	1.30.4.5
  +++ SoapSerializer.cpp	12 Dec 2003 15:10:09 -0000	1.30.4.6
  @@ -82,12 +82,27 @@
   //////////////////////////////////////////////////////////////////////
   // Construction/Destruction
   //////////////////////////////////////////////////////////////////////
  +// Following values should come from axis configuration files.
  +#define INITIAL_SERIALIZE_BUFFER_SIZE 4096
  +#define NO_OF_SERIALIZE_BUFFERS 10
   
   SoapSerializer::SoapSerializer()
   {
   	m_pSoapEnvelope = NULL;
   	m_iSoapVersion = SOAP_VER_1_1;
   	m_pOutputStream = NULL;
  +	m_nMaxBuffersToCreate = NO_OF_SERIALIZE_BUFFERS;
  +	m_nInitialBufferSize = INITIAL_SERIALIZE_BUFFER_SIZE;
  +	m_pSZBuffers = new SerializeBuffers[m_nMaxBuffersToCreate];
  +	for (int x=0; x<NO_OF_SERIALIZE_BUFFERS; x++)
  +	{
  +		m_pSZBuffers[x].inuse = 0;
  +		m_pSZBuffers[x].buffer = NULL;
  +	}
  +	m_nNextBufferSize = m_nInitialBufferSize;
  +	m_nCurrentBufferSize = 0;
  +	m_nFilledSize = 0;
  +	m_nCurrentBufferIndex = 0;
   }
   
   SoapSerializer::~SoapSerializer()
  @@ -362,39 +377,65 @@
   IWrapperSoapSerializer& SoapSerializer::operator <<(const AxisChar* cSerialized)
   {
   	int iTmpSerBufferSize = strlen(cSerialized);
  -	if((m_iCurrentSerBufferSize + iTmpSerBufferSize)>= SERIALIZE_BUFFER_SIZE) 
  +	if((m_nFilledSize + iTmpSerBufferSize)>= m_nCurrentBufferSize) 
   	{
  -		flushSerializedBuffer();		
  +		flushSerializedBuffer();
  +		/*
  +		 * Above call will send the current buffer to the transport and gets
  +		 * another buffer to be filled
  +		 */
  +		strcat(m_SZBuffers[m_nCurrentBufferIndex].buffer, cSerialized);
  +		m_nFilledSize += iTmpSerBufferSize;
   	}
  -	strcat(m_cSerializedBuffer, cSerialized);
  -	m_iCurrentSerBufferSize += iTmpSerBufferSize;
  -	return *this;
  -}
  -/*
  -IWrapperSoapSerializer& SoapSerializer::operator<<(const AxisChar* cSerialized)
  -{
  -	flushSerializedBuffer();
  -	//following is done for the time being
  -	int slen = wcslen(cSerialized);
  -	for (m_iCurrentSerBufferSize=0; m_iCurrentSerBufferSize < slen; m_iCurrentSerBufferSize++)
  +	else
   	{
  -		m_cSerializedBuffer[m_iCurrentSerBufferSize] = (char) cSerialized[m_iCurrentSerBufferSize];
  +		strcat(m_SZBuffers[m_nCurrentBufferIndex].buffer, cSerialized);
  +		m_nFilledSize += iTmpSerBufferSize;
   	}
  -	m_cSerializedBuffer[m_iCurrentSerBufferSize] = '\0';
   	return *this;
   }
  -*/
  +
   int SoapSerializer::flushSerializedBuffer()
   {
  -	//sendSoapResponse(m_cSerializedBuffer);
  +	int nStatus;
   	if (NULL != m_pOutputStream->transport.pSendFunct)
  -		m_pOutputStream->transport.pSendFunct(m_cSerializedBuffer, m_pOutputStream->str.op_stream);
  -	m_cSerializedBuffer[0]= '\0';
  -	m_iCurrentSerBufferSize=0;
  +	{
  +		nStatus = m_pOutputStream->transport.pSendFunct(
  +		m_SZBuffers[m_nCurrentBufferIndex].buffer, (void*)(&(m_SZBuffers[m_nCurrentBufferIndex].inuse)));
  +		if (TRANSPORT_FINISHED == nStatus) 
  +		/* transport layer has done with the buffer.So same buffer can be re-used*/
  +		{
  +			m_SZBuffers[m_nCurrentBufferIndex].buffer[0] = '\0'; /* put nul */
  +			m_nFilledSize = 0;
  +		}
  +		else if (TRANSPORT_IN_PROGRESS == nStatus) 
  +		/* buffer is being used by the transport layer. So we have to use another buffer*/
  +		{
  +			return SetNextSerilizeBuffer();
  +		}
  +		else
  +		{
  +			return AXIS_FAIL;
  +		}
  +	}
  +	else
  +	{
  +		return AXIS_FAIL;
  +	}
   	return AXIS_SUCCESS;
   }
   
  -int SoapSerializer::createSoapMethod(const AxisChar* sLocalName, const AxisChar* sPrefix,
const AxisChar* sURI)
  +/**
  + * This method sets the next buffer to be used for serialization.
  + *
  + */
  +int SoapSerializer::SetNextSerilizeBuffer()
  +{
  +	return AXIS_FAIL;
  +}
  +
  +int SoapSerializer::createSoapMethod(const AxisChar* sLocalName, 
  +									 const AxisChar* sPrefix, const AxisChar* sURI)
   {
   	SoapMethod* pMethod = new SoapMethod();
   	setSoapMethod(pMethod);
  @@ -709,6 +750,20 @@
   	va_end( vList);              /* Reset variable arguments.      */
   }
   
  +/**
  + * Callback function that should be called by the transport module to release a buffer
passed to it by a Serializer. 
  + * @param 
  + *		buffer - Buffer passed to transport by calling transport's AXIS_MODULE_CALLBACK_SEND_MESSAGE_BYTES

  + *				 callback
  + *		pContext - Context object passed to transport by calling transport's AXIS_MODULE_CALLBACK_SEND_MESSAGE_BYTES

  + *				 callback
  + */
  +int axis_buffer_release(const char* buffer, const void* pContext)
  +{
  +	int* pInt = (int*)pContext;
  +	*pInt = 0; /* set that the buffer is not in use */
  +	buffer[0] = '\0'; /* set nul */ 
  +}
   
   
   
  
  
  

Mime
View raw message