Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 37012 invoked from network); 15 Dec 2003 06:07:50 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 15 Dec 2003 06:07:50 -0000 Received: (qmail 1950 invoked by uid 500); 15 Dec 2003 06:07:25 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 1921 invoked by uid 500); 15 Dec 2003 06:07:25 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 1908 invoked from network); 15 Dec 2003 06:07:25 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 15 Dec 2003 06:07:25 -0000 Received: (qmail 36985 invoked by uid 1682); 15 Dec 2003 06:07:46 -0000 Date: 15 Dec 2003 06:07:46 -0000 Message-ID: <20031215060746.36984.qmail@minotaur.apache.org> From: susantha@apache.org To: ws-axis-cvs@apache.org Subject: cvs commit: ws-axis/c/src/soap SoapDeSerializer.cpp SoapSerializer.cpp X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N susantha 2003/12/14 22:07:46 Modified: c/include/axis/common Tag: CWrapperSupport Packet.h c/include/axis/soap Tag: CWrapperSupport SoapSerializer.h c/src/client Tag: CWrapperSupport Call.cpp c/src/common Tag: CWrapperSupport Packet.cpp c/src/engine Tag: CWrapperSupport Axis.cpp SerializerPool.cpp c/src/server/apache Tag: CWrapperSupport mod_axis.c c/src/soap Tag: CWrapperSupport SoapDeSerializer.cpp SoapSerializer.cpp Log: Server side is working after changes to the transport module API Revision Changes Path No revision No revision 1.1.4.6 +4 -5 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.5 retrieving revision 1.1.4.6 diff -u -r1.1.4.5 -r1.1.4.6 --- Packet.h 13 Dec 2003 13:44:00 -0000 1.1.4.5 +++ Packet.h 15 Dec 2003 06:07:45 -0000 1.1.4.6 @@ -237,6 +237,10 @@ void* reserved2; /* usage depend on the tranport module */ } Ax_soapstream; +#ifdef __cplusplus +extern "C" +{ +#endif /** * Functions to manipulate Ax_soapstream object. Implemented in Packet.cpp * @@ -244,11 +248,6 @@ int set_property(Ax_soapstream* stream, char * pchkey, char * pchvalue); const char* get_property(const Ax_soapstream* stream,const char* pchkey); void remove_all_properties(Ax_soapstream* stream); - -#ifdef __cplusplus -extern "C" -{ -#endif /** * This function is implemented in axis and should be called ONCE to uninitialize Axis Engine when the No revision No revision 1.3.4.6 +3 -1 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.5 retrieving revision 1.3.4.6 diff -u -r1.3.4.5 -r1.3.4.6 --- SoapSerializer.h 13 Dec 2003 13:44:00 -0000 1.3.4.5 +++ SoapSerializer.h 15 Dec 2003 06:07:45 -0000 1.3.4.6 @@ -107,6 +107,8 @@ int m_nFilledSize; /* Currently selected buffer index*/ int m_nCurrentBufferIndex; + /* Overall status of Serializer. If anything goes wrong this is not AXIS_SUCCESS */ + int m_nStatus; public: int AXISCALL createSoapMethod(const AxisChar* sLocalName, const AxisChar* sPrefix, const AxisChar* sURI); // IWrapperSoapSerializer& operator<<(const char* cSerialized); @@ -147,7 +149,7 @@ private: int AddOutputParamHelper(const AxisChar* pchName, XSDTYPE nType, uParamValue Value); - int flushSerializedBuffer(); + int SendSerializedBuffer(); int SetNextSerilizeBuffer(); IArrayBean* makeArrayBean(XSDTYPE nType, void* pArray); IArrayBean* makeArrayBean(void* pObject, void* pSZFunct, void* pDelFunct, void* pSizeFunct); No revision No revision 1.20.4.9 +2 -2 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.4.8 retrieving revision 1.20.4.9 diff -u -r1.20.4.8 -r1.20.4.9 --- Call.cpp 13 Dec 2003 13:44:00 -0000 1.20.4.8 +++ Call.cpp 15 Dec 2003 06:07:45 -0000 1.20.4.9 @@ -100,7 +100,7 @@ int Call::SetEndpointURI(const char *pchEndpointURI) { - m_Soap.so->http.uri_path = pchEndpointURI; + m_Soap.so.http->uri_path = pchEndpointURI; return AXIS_SUCCESS; } @@ -480,7 +480,7 @@ int Call::SetHeader(char *key, char *value) { - set_header(&m_Soap, key, value); + set_property(&m_Soap, key, value); return 0; } No revision No revision 1.9.4.3 +4 -0 ws-axis/c/src/common/Packet.cpp Index: Packet.cpp =================================================================== RCS file: /home/cvs/ws-axis/c/src/common/Packet.cpp,v retrieving revision 1.9.4.2 retrieving revision 1.9.4.3 diff -u -r1.9.4.2 -r1.9.4.3 --- Packet.cpp 13 Dec 2003 13:44:01 -0000 1.9.4.2 +++ Packet.cpp 15 Dec 2003 06:07:45 -0000 1.9.4.3 @@ -64,6 +64,9 @@ #include #include +extern "C" +{ + /** * This method is used to add a transport specific property to a stream object for Axis supported protocols * such as http. For an example "Content-Length" for http. For other protocols there should be a way to @@ -158,3 +161,4 @@ return NULL; } +} \ No newline at end of file No revision No revision 1.30.4.5 +7 -0 ws-axis/c/src/engine/Axis.cpp Index: Axis.cpp =================================================================== RCS file: /home/cvs/ws-axis/c/src/engine/Axis.cpp,v retrieving revision 1.30.4.4 retrieving revision 1.30.4.5 diff -u -r1.30.4.4 -r1.30.4.5 --- Axis.cpp 13 Dec 2003 13:44:01 -0000 1.30.4.4 +++ Axis.cpp 15 Dec 2003 06:07:45 -0000 1.30.4.5 @@ -154,6 +154,12 @@ //i.e "/abc/xyz/" part of http://somehost/abc/xyz/ string sUriWOAxis = stream->transport.pGetTrtFunct(SERVICE_URI, stream); string sServiceName; + bool bNoExt = true; + if (sUriWOAxis == "/" ) + { + bNoExt = false; + sUriWOAxis = ""; + } if (sUriWOAxis.empty()) { @@ -184,6 +190,7 @@ stream->transport.pSendFunct("", NULL, stream); stream->transport.pSendFunct((char *)pService->GetServiceName(), NULL, stream); stream->transport.pSendFunct("transport.pSendFunct("axis/", NULL, stream); stream->transport.pSendFunct((char *)pService->GetServiceName(), NULL, stream); stream->transport.pSendFunct("?wsdl", NULL, stream); stream->transport.pSendFunct("\">wsdl", NULL, stream); 1.5.4.2 +7 -12 ws-axis/c/src/engine/SerializerPool.cpp Index: SerializerPool.cpp =================================================================== RCS file: /home/cvs/ws-axis/c/src/engine/SerializerPool.cpp,v retrieving revision 1.5.4.1 retrieving revision 1.5.4.2 diff -u -r1.5.4.1 -r1.5.4.2 --- SerializerPool.cpp 21 Nov 2003 12:48:08 -0000 1.5.4.1 +++ SerializerPool.cpp 15 Dec 2003 06:07:46 -0000 1.5.4.2 @@ -94,13 +94,13 @@ else { *ppSZ = new SoapSerializer(); - if (AXIS_SUCCESS != (*ppSZ)->Init()) - { - delete *ppSZ; - *ppSZ = NULL; - unlock(); - return AXIS_FAIL; - } + } + if (AXIS_SUCCESS != (*ppSZ)->Init()) + { + delete *ppSZ; + *ppSZ = NULL; + unlock(); + return AXIS_FAIL; } unlock(); return AXIS_SUCCESS; @@ -108,11 +108,6 @@ int SerializerPool::PutInstance(SoapSerializer* pSZ) { - if (AXIS_SUCCESS != pSZ->Init()) - { - delete pSZ; - return AXIS_FAIL; - } lock(); m_SZList.push_back(pSZ); unlock(); No revision No revision 1.16.4.4 +21 -12 ws-axis/c/src/server/apache/mod_axis.c Index: mod_axis.c =================================================================== RCS file: /home/cvs/ws-axis/c/src/server/apache/mod_axis.c,v retrieving revision 1.16.4.3 retrieving revision 1.16.4.4 diff -u -r1.16.4.3 -r1.16.4.4 --- mod_axis.c 13 Dec 2003 13:44:01 -0000 1.16.4.3 +++ mod_axis.c 15 Dec 2003 06:07:46 -0000 1.16.4.4 @@ -8,7 +8,7 @@ #include #include -#define AXIS_URI_EXTENSION "/axis/" +#define AXIS_URI_EXTENSION "/axis" /* NO_OF_SERIALIZE_BUFFERS should be equal to the corresponding value in the axis configuration file */ #define NO_OF_SERIALIZE_BUFFERS 10 @@ -142,6 +142,11 @@ return TRANSPORT_IN_PROGRESS; } +static void AXISCALL release_receive_buffer(const char* buffer, const Ax_soapstream* stream) +{ + +} + static const char* AXISCALL get_transport_information(AXIS_TRANSPORT_INFORMATION_TYPE type, Ax_soapstream* stream) { const char* ptemp; @@ -153,7 +158,7 @@ if (strstr(stream->so.http->uri_path, AXIS_URI_EXTENSION)) { return strstr(stream->so.http->uri_path, AXIS_URI_EXTENSION) + - strlen(AXIS_URI_EXTENSION); + strlen(AXIS_URI_EXTENSION) + 1; } else { @@ -197,6 +202,7 @@ sstr->transport.pGetFunct = get_request_bytes; sstr->transport.pSetTrtFunct = set_transport_information; sstr->transport.pGetTrtFunct = get_transport_information; + sstr->transport.pRelBufFunct = release_receive_buffer; sstr->trtype = APTHTTP; sstr->so.http = malloc(sizeof(Ax_stream_http)); /*req_rec is used as both input and output streams*/ @@ -266,17 +272,20 @@ if(!pbuffers[index].buffer) break; contentLength += strlen(pbuffers[index].buffer); } - sprintf(strtonum, "%d", contentLength); - set_transport_information(SOAP_MESSAGE_LENGTH, strtonum, sstr); - ap_send_http_header(req_rec); - //Send all buffers - pbuffers = (sendbuffers*)sstr->reserved1; - for (index=0;index < NO_OF_SERIALIZE_BUFFERS; index++) + if (contentLength != 0) // do only if the http body is not empty. { - if(!pbuffers[index].buffer) break; - ap_rputs(pbuffers[index].buffer, req_rec); - //Let Axis know that the buffer is no longer in use - axis_buffer_release(pbuffers[index].buffer, pbuffers[index].bufferid , sstr); + sprintf(strtonum, "%d", contentLength); + set_transport_information(SOAP_MESSAGE_LENGTH, strtonum, sstr); + ap_send_http_header(req_rec); + //Send all buffers + pbuffers = (sendbuffers*)sstr->reserved1; + for (index=0;index < NO_OF_SERIALIZE_BUFFERS; index++) + { + if(!pbuffers[index].buffer) break; + ap_rputs(pbuffers[index].buffer, req_rec); + //Let Axis know that the buffer is no longer in use + axis_buffer_release(pbuffers[index].buffer, pbuffers[index].bufferid , sstr); + } } //Free the array if (sstr->reserved1) free(sstr->reserved1); No revision No revision 1.17.4.9 +2 -2 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.8 retrieving revision 1.17.4.9 diff -u -r1.17.4.8 -r1.17.4.9 --- SoapDeSerializer.cpp 12 Dec 2003 15:10:09 -0000 1.17.4.8 +++ SoapDeSerializer.cpp 15 Dec 2003 06:07:46 -0000 1.17.4.9 @@ -100,10 +100,10 @@ if (NULL != m_pInputStream->transport.pGetFunct) { do { - m_pInputStream->transport.pGetFunct(&m_pCurrentBuffer, &nChars, m_pInputStream->str.ip_stream); + m_pInputStream->transport.pGetFunct(&m_pCurrentBuffer, &nChars, m_pInputStream); if ((nChars > 0) && m_pCurrentBuffer) m_pParser->Parse(m_pCurrentBuffer, nChars); - m_pInputStream->transport.pRelBufFunct(m_pCurrentBuffer, m_pInputStream->str.ip_stream); + m_pInputStream->transport.pRelBufFunct(m_pCurrentBuffer, m_pInputStream); } while (nChars > 0); m_pParser->ParseEnd(); } 1.30.4.8 +30 -18 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.7 retrieving revision 1.30.4.8 diff -u -r1.30.4.7 -r1.30.4.8 --- SoapSerializer.cpp 13 Dec 2003 13:44:01 -0000 1.30.4.7 +++ SoapSerializer.cpp 15 Dec 2003 06:07:46 -0000 1.30.4.8 @@ -101,7 +101,6 @@ m_pSZBuffers[x].inuse = 0; m_pSZBuffers[x].buffer = NULL; } - SetNextSerilizeBuffer(); } SoapSerializer::~SoapSerializer() @@ -330,25 +329,30 @@ if(m_pSoapEnvelope) { Serialize("", NULL); iStatus= m_pSoapEnvelope->serialize(*this, (SOAP_VERSION)m_iSoapVersion); - flushSerializedBuffer(); + SendSerializedBuffer(); } return iStatus; } +/** + * Initializing the members of the class. This is needed since + * the same object instance of this class, may be used to server + * several SOAP requests. + */ int SoapSerializer::Init() { - //initializing the members of the class. This is needed since - // the same object instance of this class, may be used to server - // several SOAP requests. + m_nStatus = AXIS_SUCCESS; if(m_pSoapEnvelope) { delete m_pSoapEnvelope; m_pSoapEnvelope= NULL; } - //Adding SoapEnvelop and SoapBody to Serializer + /* Adding SoapEnvelop and SoapBody to Serializer */ m_pSoapEnvelope = new SoapEnvelope(); m_pSoapEnvelope->setSoapBody(new SoapBody()); + + SetNextSerilizeBuffer(); iCounter=0; return AXIS_SUCCESS; @@ -373,16 +377,27 @@ IWrapperSoapSerializer& SoapSerializer::operator <<(const AxisChar* cSerialized) { + if (AXIS_SUCCESS != m_nStatus) + { + /* some thing has gone wrong. So do nothing */ + return *this; + } + int iTmpSerBufferSize = strlen(cSerialized); if((m_nFilledSize + iTmpSerBufferSize)>= m_nCurrentBufferSize) { - flushSerializedBuffer(); /* - * Above call will send the current buffer to the transport and gets + * Send the current buffer to the transport and get * another buffer to be filled */ - strcat((char*)m_pSZBuffers[m_nCurrentBufferIndex].buffer, cSerialized); - m_nFilledSize += iTmpSerBufferSize; + if (AXIS_SUCCESS == SendSerializedBuffer()) + { + if (AXIS_SUCCESS == SetNextSerilizeBuffer()) + { + strcat((char*)m_pSZBuffers[m_nCurrentBufferIndex].buffer, cSerialized); + m_nFilledSize += iTmpSerBufferSize; + } + } } else { @@ -392,7 +407,7 @@ return *this; } -int SoapSerializer::flushSerializedBuffer() +int SoapSerializer::SendSerializedBuffer() { int nStatus; if (NULL != m_pOutputStream->transport.pSendFunct) @@ -403,14 +418,9 @@ /* transport layer has done with the buffer.So same buffer can be re-used*/ { m_pSZBuffers[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(); + m_pSZBuffers[m_nCurrentBufferIndex].inuse = 0; /* not in use */ } - else + else if (TRANSPORT_FAILED == nStatus) { return AXIS_FAIL; } @@ -436,6 +446,7 @@ { m_nCurrentBufferIndex = x; m_pSZBuffers[m_nCurrentBufferIndex].inuse = 1; + m_pSZBuffers[m_nCurrentBufferIndex].buffer[0] = '\0'; m_nFilledSize = 0; m_nCurrentBufferSize = m_nInitialBufferSize*(1 << m_nCurrentBufferIndex); return AXIS_SUCCESS; @@ -447,6 +458,7 @@ m_nCurrentBufferSize = m_nInitialBufferSize*(1 << m_nCurrentBufferIndex); m_pSZBuffers[m_nCurrentBufferIndex].buffer = new char[m_nCurrentBufferSize]; m_pSZBuffers[m_nCurrentBufferIndex].inuse = 1; + m_pSZBuffers[m_nCurrentBufferIndex].buffer[0] = '\0'; m_nFilledSize = 0; return AXIS_SUCCESS; }