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 su...@apache.org on 2004/01/13 08:19:52 UTC
cvs commit: ws-axis/c/src/soap SoapDeSerializer.cpp SoapParserExpat.cpp
susantha 2004/01/12 23:19:52
Modified: c/include/axis/soap SoapDeSerializer.h SoapParserExpat.h
c/src/client/samples/interoptests/base InteropBaseClient.cpp
InteropTestPortType.cpp
c/src/client/samples/interoptests/doclitbase
InteropBaseClient.cpp InteropTestPortType.cpp
c/src/client/transport/axis HttpTransport.cpp
c/src/common BasicTypeSerializer.cpp
c/src/engine ServerAxisEngine.cpp
c/src/server/apache mod_axis.c
c/src/soap SoapDeSerializer.cpp SoapParserExpat.cpp
Log:
Fixed following bugs,
1. Error occured due to the bytes remaining in the input buffer (apache buffer) even after
the web service invocation is finished.
2. Error occured due to the accumulation of entity referenced strings in BasicTypeSerializer::GetEntityReferenced(..) function.
Revision Changes Path
1.4 +1 -0 ws-axis/c/include/axis/soap/SoapDeSerializer.h
Index: SoapDeSerializer.h
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/soap/SoapDeSerializer.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SoapDeSerializer.h 12 Jan 2004 12:20:50 -0000 1.3
+++ SoapDeSerializer.h 13 Jan 2004 07:19:51 -0000 1.4
@@ -115,6 +115,7 @@
int GetVersion();
SoapEnvelope* GetEnvelope();
int GetHeader();
+ int FlushInputStream();
/*
* Methods to manipulate entire body when the body is compressed or encrypted
* These functions are provided for handlers to manipulate entire soap body.
1.3 +1 -0 ws-axis/c/include/axis/soap/SoapParserExpat.h
Index: SoapParserExpat.h
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/soap/SoapParserExpat.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SoapParserExpat.h 12 Jan 2004 12:26:38 -0000 1.2
+++ SoapParserExpat.h 13 Jan 2004 07:19:51 -0000 1.3
@@ -92,6 +92,7 @@
queue<axisxml::Event*> m_Events;
map<AxisXMLString, AxisXMLString> m_NsStack;
int m_nStatus;
+ int m_nTransportStatus;
private:
SoapParserExpat();
~SoapParserExpat();
1.8 +13 -11 ws-axis/c/src/client/samples/interoptests/base/InteropBaseClient.cpp
Index: InteropBaseClient.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/client/samples/interoptests/base/InteropBaseClient.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- InteropBaseClient.cpp 12 Jan 2004 16:06:40 -0000 1.7
+++ InteropBaseClient.cpp 13 Jan 2004 07:19:51 -0000 1.8
@@ -1,7 +1,7 @@
#include "InteropTestPortType.h"
-#define ARRAYSIZE 1000
-#define LOOPFOR 100
+#define ARRAYSIZE 1
+#define LOOPFOR 1
int main(int argc, char* argv[])
{
@@ -15,39 +15,41 @@
printf("successful\n");
else
printf("failed\n");
-*/ // testing echoStringArray
+ // testing echoStringArray
ArrayOfstring arrstr;
arrstr.m_Array = new char*[ARRAYSIZE];
arrstr.m_Size = ARRAYSIZE;
for (x=0;x<ARRAYSIZE;x++)
{
- sprintf(buffer1, "%dth element of string array", x);
- arrstr.m_Array[x] = strdup(buffer1);
+ // sprintf(buffer1, "sdth element o sas fjas asl jasldjf asldg aladlg ajg alds lajsfd jasdfj asdjfa sjfda jdsflaflakjdsfaljs fajsfj asflajs jasdfj asdfjasdjf asldjfalsjd fasdjf jsadfsaj asjf asljdfasdkf asjfsaj asdkjf hjas galgjfdgas dkjasdtring array", x); //< >>> && &&''''' \" \" ><<<<&&& 7&777 7&&^f
+ arrstr.m_Array[x] = strdup("a sjda slfkas jlfj asldfjafj");
}
printf("invoking echoStringArray...\n");
for(int ix=0;ix<LOOPFOR; ix++)
{
ArrayOfstring retarrstr = ws.echoStringArray(arrstr);
if ((retarrstr.m_Array != NULL) && (retarrstr.m_Size == ARRAYSIZE)) {
- /* for (x=0;x<ARRAYSIZE;x++)
+ for (x=0;x<ARRAYSIZE;x++)
{
printf("%s\n", retarrstr.m_Array[x]);
+ free(retarrstr.m_Array[x]);
}
- printf("successful\n");
- */
+ free(retarrstr.m_Array);
+ //printf("successful\n");
+
}
else
printf("failed\n");
}
printf("Done\n");
- // testing echoInteger
-/* printf("invoking echoInteger...\n");
+*/ // testing echoInteger
+ printf("invoking echoInteger...\n");
if (ws.echoInteger(56) == 56)
printf("successful\n");
else
printf("failed\n");
// testing echoIntegerArray
- ArrayOfint arrint;
+/* ArrayOfint arrint;
arrint.m_Array = new int[ARRAYSIZE];
arrint.m_Size = ARRAYSIZE;
for (x=0;x<ARRAYSIZE;x++)
1.11 +1 -1 ws-axis/c/src/client/samples/interoptests/base/InteropTestPortType.cpp
Index: InteropTestPortType.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/client/samples/interoptests/base/InteropTestPortType.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- InteropTestPortType.cpp 12 Jan 2004 12:20:51 -0000 1.10
+++ InteropTestPortType.cpp 13 Jan 2004 07:19:51 -0000 1.11
@@ -18,7 +18,7 @@
{
m_pCall = new Call();
m_pCall->SetProtocol(APTHTTP);
- m_pCall->SetEndpointURI("http://localhost/axis/InteropBase");
+ m_pCall->SetEndpointURI("http://localhost:5555/axis/InteropBase");
}
InteropTestPortType::~InteropTestPortType()
1.3 +30 -22 ws-axis/c/src/client/samples/interoptests/doclitbase/InteropBaseClient.cpp
Index: InteropBaseClient.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/client/samples/interoptests/doclitbase/InteropBaseClient.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- InteropBaseClient.cpp 12 Jan 2004 12:39:54 -0000 1.2
+++ InteropBaseClient.cpp 13 Jan 2004 07:19:51 -0000 1.3
@@ -3,7 +3,8 @@
#include "InteropTestPortType.h"
-#define ARRAYSIZE 300
+#define ARRAYSIZE 2000
+#define LOOPFOR 100
int main(int argc, char* argv[])
{
@@ -23,20 +24,27 @@
arrstr.m_Size = ARRAYSIZE;
for (x=0;x<ARRAYSIZE;x++)
{
- sprintf(buffer1, "%dth element of string array", x);
+ sprintf(buffer1, "%dth element <@#$%^&*()~`'\"?/><.,-_=+ ][}{|of string array", x);
arrstr.m_Array[x] = strdup(buffer1);
}
printf("invoking echoStringArray...\n");
- ArrayOfstring retarrstr = ws.echoStringArray(arrstr);
- if ((retarrstr.m_Array != NULL) && (retarrstr.m_Size == ARRAYSIZE)) {
- for (x=0;x<ARRAYSIZE;x++)
- {
- printf("%s\n", retarrstr.m_Array[x]);
+ for(int ix=0;ix<LOOPFOR; ix++)
+ {
+ ArrayOfstring retarrstr = ws.echoStringArray(arrstr);
+ if ((retarrstr.m_Array != NULL) && (retarrstr.m_Size == ARRAYSIZE)) {
+ for (x=0;x<ARRAYSIZE;x++)
+ {
+ // printf("%s\n", retarrstr.m_Array[x]);
+ free(retarrstr.m_Array[x]);
+ }
+ free(retarrstr.m_Array);
+ printf("successful\n");
+
}
- printf("successful\n");
+ else
+ printf("failed\n");
}
- else
- printf("failed\n");
+ printf("Done\n");
// testing echoInteger
/* printf("invoking echoInteger...\n");
if (ws.echoInteger(56) == 56)
@@ -107,12 +115,12 @@
ws.echoVoid();
printf("successful\n");
//testing echo base 64 binary
- printf("invoking echoBase64...\n");
- if (0 == strcmp(ws.echoBase64("BCDF675E234242WHRTKMJDGKGUEJ898636JFJFHEJDGWTDHFJRURYGBCDHTWRSG"),
- "BCDF675E234242WHRTKMJDGKGUEJ898636JFJFHEJDGWTDHFJRURYGBCDHTWRSG"))
- printf("successful\n");
- else
- printf("failed\n");
+// printf("invoking echoBase64...\n");
+// if (0 == strcmp(ws.echoBase64("BCDF675E234242WHRTKMJDGKGUEJ898636JFJFHEJDGWTDHFJRURYGBCDHTWRSG"),
+// "BCDF675E234242WHRTKMJDGKGUEJ898636JFJFHEJDGWTDHFJRURYGBCDHTWRSG"))
+// printf("successful\n");
+// else
+// printf("failed\n");
time_t tim;
time(&tim);
tm* lt = gmtime(&tim);
@@ -122,12 +130,12 @@
else
printf("failed\n");
//testing echo hex binary
- printf("invoking echoHexBinary...\n");
- if (0 == strcmp(ws.echoHexBinary("CCCFFA46552BC7D5A09BC5F23DE9E0FE7862AD45BC87D02FEE"),
- "CCCFFA46552BC7D5A09BC5F23DE9E0FE7862AD45BC87D02FEE"))
- printf("successful\n");
- else
- printf("failed\n");
+// printf("invoking echoHexBinary...\n");
+// if (0 == strcmp(ws.echoHexBinary("CCCFFA46552BC7D5A09BC5F23DE9E0FE7862AD45BC87D02FEE"),
+// "CCCFFA46552BC7D5A09BC5F23DE9E0FE7862AD45BC87D02FEE"))
+// printf("successful\n");
+// else
+// printf("failed\n");
//testing echo decimal
printf("invoking echoDecimal...\n");
if (ws.echoDecimal(1234.567890) > 1234.56)
1.3 +1 -1 ws-axis/c/src/client/samples/interoptests/doclitbase/InteropTestPortType.cpp
Index: InteropTestPortType.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/client/samples/interoptests/doclitbase/InteropTestPortType.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- InteropTestPortType.cpp 12 Jan 2004 12:39:54 -0000 1.2
+++ InteropTestPortType.cpp 13 Jan 2004 07:19:51 -0000 1.3
@@ -18,7 +18,7 @@
{
m_pCall = new Call();
m_pCall->SetProtocol(APTHTTP);
- m_pCall->SetEndpointURI("http://localhost:5555/axis/InteropBaseDL");
+ m_pCall->SetEndpointURI("http://localhost/axis/InteropBaseDL");
}
InteropTestPortType::~InteropTestPortType()
1.12 +1 -2 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.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- HttpTransport.cpp 12 Jan 2004 16:46:14 -0000 1.11
+++ HttpTransport.cpp 13 Jan 2004 07:19:51 -0000 1.12
@@ -150,9 +150,8 @@
if(m_IsHttpHeader == 1)
{
//printf("m_IsHttpHeader == 1\n");
- m_Channel >> m_PayLoad;
+ m_Channel >> m_PayLoad;
*pPayLoad = m_PayLoad.c_str();
-
return *this;
}
//printf("tmpPacket:%s\n", tmpPacket.c_str());
1.18 +1 -0 ws-axis/c/src/common/BasicTypeSerializer.cpp
Index: BasicTypeSerializer.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/common/BasicTypeSerializer.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- BasicTypeSerializer.cpp 12 Jan 2004 12:20:52 -0000 1.17
+++ BasicTypeSerializer.cpp 13 Jan 2004 07:19:51 -0000 1.18
@@ -317,6 +317,7 @@
/// Encode XML entities if any found in user data.
const AxisString& BasicTypeSerializer::GetEntityReferenced(const AxisString& strVal)
{
+ m_strReturnVal = "";
if (strVal.empty())
return strVal;
1.13 +6 -0 ws-axis/c/src/engine/ServerAxisEngine.cpp
Index: ServerAxisEngine.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/ServerAxisEngine.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ServerAxisEngine.cpp 12 Jan 2004 12:20:53 -0000 1.12
+++ ServerAxisEngine.cpp 13 Jan 2004 07:19:51 -0000 1.13
@@ -316,6 +316,12 @@
}
while(0);
+ if (AXIS_SUCCESS != m_pDZ->FlushInputStream())
+ {
+ m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_SOAPCONTENTERROR));
+ return AXIS_SUCCESS;
+ }
+
pMsg->setPastPivotState(true);
/*
1.19 +1 -1 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.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- mod_axis.c 12 Jan 2004 12:20:53 -0000 1.18
+++ mod_axis.c 13 Jan 2004 07:19:51 -0000 1.19
@@ -27,7 +27,7 @@
/*extern int process(soapstream *);*/
extern unsigned char chEBuf[1024];
-#define SIZEOFMODULEBUFFER 100
+#define SIZEOFMODULEBUFFER 512
char g_buffer[SIZEOFMODULEBUFFER];
1.20 +19 -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.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- SoapDeSerializer.cpp 12 Jan 2004 12:20:54 -0000 1.19
+++ SoapDeSerializer.cpp 13 Jan 2004 07:19:51 -0000 1.20
@@ -2101,3 +2101,22 @@
/*TODO*/
return false;
}
+
+int SoapDeSerializer::FlushInputStream()
+{
+ int nChars = 0;
+ const char* pBuffer;
+ if (TRANSPORT_IN_PROGRESS == m_pParser->m_nTransportStatus)
+ {
+ do
+ {
+ m_pParser->m_nTransportStatus = m_pParser->m_pInputStream->transport.pGetFunct(&pBuffer, &nChars, m_pParser->m_pInputStream);
+ if ((nChars > 0) && pBuffer) /* there can be a buffer or not */
+ {
+ m_pParser->m_pInputStream->transport.pRelBufFunct(pBuffer, m_pParser->m_pInputStream);
+ }
+
+ }while (TRANSPORT_IN_PROGRESS == m_pParser->m_nTransportStatus);
+ }
+ return (TRANSPORT_FINISHED == m_pParser->m_nTransportStatus)? AXIS_SUCCESS : AXIS_FAIL;
+}
1.3 +5 -13 ws-axis/c/src/soap/SoapParserExpat.cpp
Index: SoapParserExpat.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/SoapParserExpat.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SoapParserExpat.cpp 12 Jan 2004 12:26:38 -0000 1.2
+++ SoapParserExpat.cpp 13 Jan 2004 07:19:51 -0000 1.3
@@ -70,19 +70,11 @@
#include <axis/soap/SoapParserExpat.h>
-/*
-#include <axis/common/TypeMapping.h>
-#include <axis/soap/URIMapping.h>
-#include <axis/soap/Attribute.h>
-#include <axis/soap/SoapEnvVersions.h>
-#include <axis/soap/CharacterElement.h>
-#include <axis/common/AxisUtils.h>
-*/
-
SoapParserExpat::SoapParserExpat()
{
m_pLastEvent = NULL;
m_Parser = XML_ParserCreateNS(NULL, NAMESPACESEPARATOR);
+ m_nTransportStatus = TRANSPORT_IN_PROGRESS;
}
SoapParserExpat::~SoapParserExpat()
@@ -247,17 +239,16 @@
int SoapParserExpat::ParseNext()
{
- int nStatus;
int nChars = 0;
- nStatus = m_pInputStream->transport.pGetFunct(&m_pCurrentBuffer, &nChars, m_pInputStream);
+ m_nTransportStatus = m_pInputStream->transport.pGetFunct(&m_pCurrentBuffer, &nChars, m_pInputStream);
if ((nChars > 0) && m_pCurrentBuffer) /* there can be a buffer or not */
{
if (XML_STATUS_ERROR == XML_Parse(m_Parser, m_pCurrentBuffer, nChars, false))
m_nStatus = AXIS_FAIL;
m_pInputStream->transport.pRelBufFunct(m_pCurrentBuffer, m_pInputStream);
}
- if (TRANSPORT_FAILED == nStatus) XML_Parse(m_Parser, NULL, 0, true); /* end of parsing */
- return nStatus;
+ if (TRANSPORT_FAILED == m_nTransportStatus) XML_Parse(m_Parser, NULL, 0, true); /* end of parsing */
+ return m_nTransportStatus;
}
int SoapParserExpat::GetStatus()
@@ -286,6 +277,7 @@
delete m_pLastEvent;
}
m_pLastEvent = NULL;
+ m_nTransportStatus = TRANSPORT_IN_PROGRESS;
return m_nStatus;
}