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 2003/10/16 15:12:46 UTC
cvs commit: ws-axis/c/src/server/samples/simplewebservice/webservicewrapper WebServiceWrapper.cpp
damitha 2003/10/16 06:12:46
Modified: c/src/client/samples/Calculator CalcClient.cpp
Calculator.cpp
c/src/common Handler.h IMessageData.h
c/src/engine AppScopeHandlerPool.cpp Axis.cpp
HandlerPool.cpp RequestScopeHandlerPool.cpp
ServerAxisEngine.cpp SessionScopeHandlerPool.cpp
c/src/server/handlers/custom/loghandler LogHandler.cpp
LogHandler.h
c/src/server/samples/simplewebservice/webservicewrapper
WebServiceWrapper.cpp
Log:
updated the source so that handlers work with the updated code. also made changes to
handlers/custome/loghandler class so that it uses <stdio.h> instead of <fstream.h>
Added GetWebService and SetWebService methods to IMessageData.h interface.
Revision Changes Path
1.10 +2 -3 ws-axis/c/src/client/samples/Calculator/CalcClient.cpp
Index: CalcClient.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/client/samples/Calculator/CalcClient.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- CalcClient.cpp 15 Oct 2003 06:11:27 -0000 1.9
+++ CalcClient.cpp 16 Oct 2003 13:12:46 -0000 1.10
@@ -12,10 +12,9 @@
for (int n=0;n<1; n++)
{
int result = cal.Add(99, 23);
-
printf("Result of 99+23=%d\n", result);
- Point* p1 = new Point();
+/* Point* p1 = new Point();
p1->x = 11;
p1->y = 22;
Point* p2 = new Point();
@@ -52,7 +51,7 @@
}
cal.EchoPolygon(p);
-
+ */
}
printf("Done\n");
return 0;
1.17 +3 -1 ws-axis/c/src/client/samples/Calculator/Calculator.cpp
Index: Calculator.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/client/samples/Calculator/Calculator.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Calculator.cpp 13 Oct 2003 05:03:13 -0000 1.16
+++ Calculator.cpp 16 Oct 2003 13:12:46 -0000 1.17
@@ -41,7 +41,7 @@
/* The value for SOAPAction is specified in the binding section of the WSDL */
m_pCall->SetHeader("SOAPAction", "servicename");
/* End point URI too can be taken from WSDL */
- m_pCall->SetEndpointURI("http://127.0.0.1:80/axis/Calculator");
+ m_pCall->SetEndpointURI("http://192.168.101.4:80/axis/Calculator");
}
Calculator::~Calculator()
@@ -65,7 +65,9 @@
nStatus = m_pCall->Invoke();
if (SUCCESS == nStatus)
{
+ printf("if (SUCCESS == nStatus)");
ret = m_pCall->GetResult()->GetInt();
+ printf("%s\n", "ret = m_pCall->GetResult()->GetInt();");
#ifdef _DEBUG
printf("%s%d", "Got The result", ret);
#endif
1.7 +3 -0 ws-axis/c/src/common/Handler.h
Index: Handler.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/common/Handler.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Handler.h 15 Oct 2003 13:40:11 -0000 1.6
+++ Handler.h 16 Oct 2003 13:12:46 -0000 1.7
@@ -7,6 +7,7 @@
#include "BasicHandler.h"
#include <map>
+#include "AxisTrace.h"
using namespace std;
class Handler : public BasicHandler
@@ -14,9 +15,11 @@
public:
Handler(){};
virtual ~Handler(){};
+
virtual const string& GetOption(const string& sArg)=0;
virtual void SetOptionList(const map<string, string>* OptionList)=0;
int GetType(){return NORMAL_HANDLER;};
+
protected:
const map<string, string>* m_pOption;
1.10 +3 -0 ws-axis/c/src/common/IMessageData.h
Index: IMessageData.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/common/IMessageData.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- IMessageData.h 16 Oct 2003 11:54:27 -0000 1.9
+++ IMessageData.h 16 Oct 2003 13:12:46 -0000 1.10
@@ -67,6 +67,7 @@
#if !defined(AFX_IMESSAGEDATA_H__EEFDCDB4_6ABA_48CA_8B45_B4FDA6045822__INCLUDED_)
#define AFX_IMESSAGEDATA_H__EEFDCDB4_6ABA_48CA_8B45_B4FDA6045822__INCLUDED_
+#include "../wsdd/WSDDService.h"
#include <string>
using namespace std;
@@ -99,6 +100,8 @@
virtual void SetUserName(string& m_sUserName)=0;
virtual string& GetUserName()=0;
+ virtual void SetService(const WSDDService* argService) = 0;
+ virtual const WSDDService* GetService() = 0;
virtual bool isPastPivot()=0;
virtual int setPastPivotState(bool bState)=0;
1.4 +2 -0 ws-axis/c/src/engine/AppScopeHandlerPool.cpp
Index: AppScopeHandlerPool.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/AppScopeHandlerPool.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AppScopeHandlerPool.cpp 27 Aug 2003 12:16:34 -0000 1.3
+++ AppScopeHandlerPool.cpp 16 Oct 2003 13:12:46 -0000 1.4
@@ -65,6 +65,7 @@
#include "AppScopeHandlerPool.h"
#include "HandlerLoader.h"
+#include "../common/AxisTrace.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
@@ -95,6 +96,7 @@
//MUST block itself and wait if the requested handler is not found.
int AppScopeHandlerPool::GetInstance(BasicHandler** pHandler, int nLibId)
{
+ AXISTRACE1("AppScopeHandlerPool::GetInstance");
lock();
int Status;
if (m_Handlers.find(nLibId) != m_Handlers.end())
1.26 +3 -3 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.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- Axis.cpp 15 Oct 2003 06:11:28 -0000 1.25
+++ Axis.cpp 16 Oct 2003 13:12:46 -0000 1.26
@@ -69,7 +69,7 @@
#endif
#include "ServerAxisEngine.h"
-//#include "../common/AxisTrace.h"
+#include "../common/AxisTrace.h"
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
@@ -142,8 +142,7 @@
if (SUCCESS == engine->Initialize())
{
Status = engine->Process(str);
- // AXISTRACE1("Status = engine->Process(str);");
- // AXISTRACE1("are we successful?");
+ AXISTRACE1("Status = engine->Process(str):status:");
}
delete engine;
}
@@ -233,6 +232,7 @@
str->transport.pSendFunct("Unknown Protocol", str->str.op_stream);
break;
}
+ AXISTRACE1("before return Status;");
return Status;
}
1.14 +1 -0 ws-axis/c/src/engine/HandlerPool.cpp
Index: HandlerPool.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/HandlerPool.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- HandlerPool.cpp 15 Oct 2003 13:40:11 -0000 1.13
+++ HandlerPool.cpp 16 Oct 2003 13:12:46 -0000 1.14
@@ -258,6 +258,7 @@
{
AXISTRACE1("Normal Handler");
((Handler*)pBH)->SetOptionList(pWSDDH->GetParameterList());
+ AXISTRACE1("((Handler*)pBH)->SetOptionList(pWSDDH->GetParameterList());");
pChain->AddHandler(static_cast<Handler*>(pBH), pWSDDH->GetScope(), pWSDDH->GetLibId());
AXISTRACE1("after pChain->AddHandler");
}
1.4 +2 -0 ws-axis/c/src/engine/RequestScopeHandlerPool.cpp
Index: RequestScopeHandlerPool.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/RequestScopeHandlerPool.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RequestScopeHandlerPool.cpp 27 Aug 2003 12:16:35 -0000 1.3
+++ RequestScopeHandlerPool.cpp 16 Oct 2003 13:12:46 -0000 1.4
@@ -65,6 +65,7 @@
#include "RequestScopeHandlerPool.h"
#include "HandlerLoader.h"
+#include "../common/AxisTrace.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
@@ -91,6 +92,7 @@
int RequestScopeHandlerPool::GetInstance(BasicHandler** pHandler, int nLibId)
{
+ AXISTRACE1("RequestScopeHandlerPool::GetInstance");
lock();
int Status;
if (m_Handlers.find(nLibId) != m_Handlers.end())
1.9 +1 -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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ServerAxisEngine.cpp 15 Oct 2003 13:40:11 -0000 1.8
+++ ServerAxisEngine.cpp 16 Oct 2003 13:12:46 -0000 1.9
@@ -270,6 +270,7 @@
{
case AE_SERV: //Everything Success.
+ AXISTRACE1("case AE_SERV:");
Status = SUCCESS;
//no break;
case AE_SERH: //actual web service handler has failed
1.5 +2 -0 ws-axis/c/src/engine/SessionScopeHandlerPool.cpp
Index: SessionScopeHandlerPool.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/SessionScopeHandlerPool.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SessionScopeHandlerPool.cpp 15 Oct 2003 06:11:28 -0000 1.4
+++ SessionScopeHandlerPool.cpp 16 Oct 2003 13:12:46 -0000 1.5
@@ -67,6 +67,7 @@
#include "SessionScopeHandlerPool.h"
#include "HandlerLoader.h"
+#include "../common/AxisTrace.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
@@ -98,6 +99,7 @@
int SessionScopeHandlerPool::GetInstance(string& sSessionId, BasicHandler** pHandler, int nLibId)
{
+ AXISTRACE1("SessionScopeHandlerPool::GetInstance");
lock();
int Status;
if (m_Handlers.find(nLibId) != m_Handlers.end())
1.10 +48 -43 ws-axis/c/src/server/handlers/custom/loghandler/LogHandler.cpp
Index: LogHandler.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/server/handlers/custom/loghandler/LogHandler.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- LogHandler.cpp 15 Oct 2003 13:40:11 -0000 1.9
+++ LogHandler.cpp 16 Oct 2003 13:12:46 -0000 1.10
@@ -62,12 +62,13 @@
#include "LogHandler.h"
#include "../../../../soap/SoapDeSerializer.h"
#include "../../../../soap/SoapSerializer.h"
-//#include <AxisTrace.h>
+#include <AxisTrace.h>
#include <AxisException.h>
-#include <fstream>
+#include <time.h>
+#include <stdio.h>
#include <string>
-
+#define linesize 16
using namespace std;
LogHandler::LogHandler()
@@ -84,55 +85,60 @@
// Implementation of BasicHandler interface.
int LogHandler::Invoke(IMessageData* md)
{
-// AXISTRACE1("LogHandler::Invoke(IMessageData* md)");
-// AXIS_TRY
+ AXISTRACE1("LogHandler::Invoke(IMessageData* md)");
+ AXIS_TRY
- m_iNumAccess = 0;
- string sNumAccess = "";
+ char line[linesize] = {0};
+ char printcount[linesize] = {0};
string s = "logAccessCountFile";
string sFileName = GetOption(s);
-
+ AXISTRACE2("sFileName", sFileName.c_str());
if(!sFileName.empty())
{
-
-// AXISTRACE1("if(!sFileName.empty())");
-
- ifstream fin(sFileName.c_str()); // open for reading
- char ch;
-
- while (fin.get(ch))
- {
- sNumAccess += ch;
-
- }
-
- if(sNumAccess.empty())
- {
- m_iNumAccess = 0;
- }
- else
- {
- m_iNumAccess = atoi(sNumAccess.c_str());
- }
-
- m_iNumAccess++;
- sNumAccess = m_iNumAccess;
-
- const char * FileName = sFileName.c_str();
- ofstream fout(FileName); // open for writing
- fout << m_iNumAccess;
-// AXISTRACE1("LogHandler Invoke end");
- fin.close();
- fout.close();
- return SUCCESS;
+ AXISTRACE1("file name not empty");
+ if ((fileLogCount = fopen(sFileName.c_str(), "rt")) == NULL)
+ return FAIL;
+ int nLineCount = 0;
+ AXISTRACE1("file opened for read");
+ while(fgets(line, linesize, fileLogCount) != NULL)
+ {
+ AXISTRACE1("LINE IS:");
+ nLineCount++;
+ }
+ nLineCount = (nLineCount/6);
+ nLineCount++;
+ fclose(fileLogCount);
+
+ if ((fileLogCount = fopen(sFileName.c_str(), "a")) == NULL)
+ return FAIL;
+ else
+ {
+ AXISTRACE1("file opened for write");
+ time_t ltime;
+ time(<ime);
+
+ fputs("time : ", fileLogCount);
+ fputs(ctime(<ime), fileLogCount);
+ fputs(": service ", fileLogCount);
+ fputs(md->GetService()->GetServiceName(), fileLogCount);
+ fputs(" is accessed ", fileLogCount);
+ sprintf(printcount,"%d", nLineCount);
+ fputs(printcount, fileLogCount);
+ fputs(" times.\n", fileLogCount);
+ }
+ fclose(fileLogCount);
+
+ AXISTRACE1("LogHandler Invoke end");
+
+ return SUCCESS;
}
else
{
return FAIL;
}
-// AXIS_CATCH(...)
-// return FAIL;
-// AXIS_ENDCATCH
+ AXIS_CATCH(...)
+ return FAIL;
+ AXIS_ENDCATCH
}
void LogHandler::OnFault(IMessageData* mc)
@@ -149,7 +155,6 @@
}
return m_sEmpty;
}
-
void LogHandler::SetOptionList(const map<string, string>* OptionList)
{
1.6 +3 -1 ws-axis/c/src/server/handlers/custom/loghandler/LogHandler.h
Index: LogHandler.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/server/handlers/custom/loghandler/LogHandler.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- LogHandler.h 15 Oct 2003 13:40:11 -0000 1.5
+++ LogHandler.h 16 Oct 2003 13:12:46 -0000 1.6
@@ -83,7 +83,9 @@
void SetOptionList(const map<string, string>* OptionList);
protected:
- int m_iNumAccess;
string m_sEmpty;
+
+private:
+ FILE* fileLogCount;
};
1.8 +6 -0 ws-axis/c/src/server/samples/simplewebservice/webservicewrapper/WebServiceWrapper.cpp
Index: WebServiceWrapper.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/server/samples/simplewebservice/webservicewrapper/WebServiceWrapper.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- WebServiceWrapper.cpp 16 Oct 2003 08:12:23 -0000 1.7
+++ WebServiceWrapper.cpp 16 Oct 2003 13:12:46 -0000 1.8
@@ -66,6 +66,7 @@
//////////////////////////////////////////////////////////////////////
#include "WebServiceWrapper.h"
+#include "../../../common/AxisTrace.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
@@ -133,13 +134,18 @@
// Implementation of WrapperClassHandler interfaces.
int webservicewrapper::Invoke(IMessageData* mc)
{
+ AXISTRACE1("webservicewrapper::Invoke");
IWrapperSoapDeSerializer* pIWrapperSoapDeSerializer;
mc->getSoapDeSerializer(&pIWrapperSoapDeSerializer);
const AxisChar* method = pIWrapperSoapDeSerializer->GetMethodName();
+ AXISTRACE2("method name is:", method);
if (0 == strcmp(method, "Echo"))
return Echo(mc);
else if (0 == strcmp(method, "Add"))
+ {
+ AXISTRACE1("else if (0 == s...))");
return Add(mc);
+ }
else if (0 == strcmp(method, "EchoIntArray"))
return EchoIntArray(mc);
else if (0 == strcmp(method, "AddPoint"))