You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ro...@apache.org on 2004/03/31 17:05:41 UTC
cvs commit: ws-axis/c/src/wsdd WSDDDeployment.cpp
roshan 2004/03/31 07:05:41
Modified: c/include/axis/server AxisConfig.h
c/src/common AxisConfig.cpp
c/src/engine/client ClientAxisEngine.h ClientAxisEngine.cpp
c/src/engine Axis.cpp
c/src/wsdd WSDDDeployment.cpp
Log:
changes made to support Client Side Handler processing
Revision Changes Path
1.4 +8 -0 ws-axis/c/include/axis/server/AxisConfig.h
Index: AxisConfig.h
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/server/AxisConfig.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AxisConfig.h 14 Jan 2004 09:37:56 -0000 1.3
+++ AxisConfig.h 31 Mar 2004 15:05:41 -0000 1.4
@@ -89,6 +89,13 @@
* @return the AxisLog file path.
*/
char* GetAxisLogPath();
+
+ /**
+ * This is called to get the client.wsdd file path.
+ *
+ * @return the client.wsdd file path
+ */
+ char* GetClientWsddFilePath();
/**
* This method will read from the configuration file called axiscpp.conf
@@ -108,6 +115,7 @@
char* m_sAxisHome;
char* m_sWsddFilePath;
char* m_sAxisLogPath;
+ char* m_sClientWsddFilePath;
char* m_sValue;
char m_sLine[CONFBUFFSIZE];
};
1.14 +15 -0 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.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- AxisConfig.cpp 24 Mar 2004 06:57:31 -0000 1.13
+++ AxisConfig.cpp 31 Mar 2004 15:05:41 -0000 1.14
@@ -70,6 +70,7 @@
{
m_sWsddFilePath = (char*) malloc(CONFBUFFSIZE);
m_sAxisLogPath = (char*) malloc(CONFBUFFSIZE);
+ m_sClientWsddFilePath = (char*) malloc(CONFBUFFSIZE);
m_sAxisHome = (char*) malloc(CONFBUFFSIZE);
m_sValue = NULL;
@@ -77,10 +78,12 @@
/*#ifdef WIN32
strcpy(m_sWsddFilePath, "c:/Axis/conf/server.wsdd");
strcpy(m_sAxisLogPath, "c:/Axis/conf/AxisLog");
+ m_sClientWsddFilePath
#else
strcpy(m_sWsddFilePath, "/usr/local/apache/Axis/conf/server.wsdd");
strcpy(m_sAxisLogPath, "/usr/local/apache/Axis/logs/AxisLog");
+ m_sClientWsddFilePath
#endif
*/
@@ -90,6 +93,7 @@
{
if(m_sWsddFilePath) delete m_sWsddFilePath;
if(m_sAxisLogPath) delete m_sAxisLogPath;
+ if(m_sClientWsddFilePath) delete m_sClientWsddFilePath;
if(m_sAxisHome) delete m_sAxisHome;
if(m_sValue) delete m_sValue;
@@ -166,6 +170,11 @@
strncpy(m_sAxisLogPath, m_sValue + 1, linesize - strlen(key) - 2);
m_sAxisLogPath[linesize - strlen(key) - 2] = '\0';
}
+ if(strcmp(key, "CLIENTWSDDFILEPATH") == 0)
+ {
+ strncpy(m_sClientWsddFilePath, m_sValue + 1, linesize - strlen(key) - 2);
+ m_sClientWsddFilePath[linesize - strlen(key) - 2] = '\0';
+ }
}
@@ -180,6 +189,12 @@
char* AxisConfig::GetAxisLogPath()
{
return m_sAxisLogPath;
+}
+
+
+char* AxisConfig::GetClientWsddFilePath()
+{
+ return m_sClientWsddFilePath;
}
char* AxisConfig::GetAxisHomePath()
1.4 +1 -0 ws-axis/c/src/engine/client/ClientAxisEngine.h
Index: ClientAxisEngine.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/client/ClientAxisEngine.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ClientAxisEngine.h 26 Mar 2004 07:28:08 -0000 1.3
+++ ClientAxisEngine.h 31 Mar 2004 15:05:41 -0000 1.4
@@ -25,6 +25,7 @@
virtual void OnFault(MessageData* pMsg);
private:
Ax_soapstream* m_pSoap;
+ char* get_service_name(const char* pch_uri_path);
};
#endif // !defined(AFX_CLIENTAXISENGINE_H__4DA1EBC5_C7D8_4747_8069_C3E8B6A2E929__INCLUDED_)
1.3 +74 -47 ws-axis/c/src/engine/client/ClientAxisEngine.cpp
Index: ClientAxisEngine.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/client/ClientAxisEngine.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ClientAxisEngine.cpp 26 Mar 2004 07:28:08 -0000 1.2
+++ ClientAxisEngine.cpp 31 Mar 2004 15:05:41 -0000 1.3
@@ -33,7 +33,7 @@
int ClientAxisEngine::Process(Ax_soapstream* pSoap)
{
int Status;
- //const WSDDService* pService = NULL;
+ const WSDDService* pService = NULL;
if (!pSoap)
{
@@ -53,22 +53,27 @@
do {
//const char* cService = get_header(soap, SOAPACTIONHEADER);
-/*
+
+ const char* pchService = get_service_name(pSoap->so.http->uri_path);
+ /* get service description object from the WSDD Deployment object */
+ pService = g_pWSDDDeployment->GetService(pchService);
+
//Get Global and Transport Handlers
- if(AXIS_SUCCESS != (Status = InitializeHandlers(sSessionId, soap->trtype)))
+ if(AXIS_SUCCESS != (Status = InitializeHandlers(sSessionId, pSoap->trtype)))
{
break; //do .. while(0)
}
//Get Service specific Handlers from the pool if configured any
- if(AXIS_SUCCESS != (Status = g_pHandlerPool->GetRequestFlowHandlerChain(&m_pSReqFChain, sSessionId, pService)))
- {
- break; //do .. while(0)
- }
- if(AXIS_SUCCESS != (Status = g_pHandlerPool->GetResponseFlowHandlerChain(&m_pSResFChain, sSessionId, pService)))
- {
- break; //do .. while(0)
+ if (pService != NULL) {
+ if(AXIS_SUCCESS != (Status = g_pHandlerPool->GetRequestFlowHandlerChain(&m_pSReqFChain, sSessionId, pService)))
+ {
+ break; //do .. while(0)
+ }
+ if(AXIS_SUCCESS != (Status = g_pHandlerPool->GetResponseFlowHandlerChain(&m_pSResFChain, sSessionId, pService)))
+ {
+ break; //do .. while(0)
+ }
}
-*/
//Invoke all handlers and then the remote webservice
Status = Invoke(m_pMsgData); //we generate response in the same way even if this has failed
@@ -86,15 +91,10 @@
int ClientAxisEngine::Invoke(MessageData* pMsg)
{
- enum AE_LEVEL {AE_START=1, AE_TRH, AE_GLH, AE_SERH, AE_SERV};
+ enum AE_LEVEL {AE_START=1, AE_SERH, AE_GLH, AE_TRH, AE_SERV};
int Status = AXIS_FAIL;
- //int level = AE_START;
- /*
- No Client side handlers for now. Therefore returns AXIS_SUCCESS
- */
- Status = AXIS_SUCCESS;
+ int level = AE_START;
- /*
do
{
//invoke client side service specific request handlers
@@ -102,85 +102,93 @@
{
if(AXIS_SUCCESS != (Status = m_pSReqFChain->Invoke(pMsg)))
{
- m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_CLIENTHANDLERFAILED));
+ //m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_CLIENTHANDLERFAILED));
break; //do .. while (0)
}
}
// AXISTRACE1("AFTER invoke service specific request handlers");
- level++; //AE_SERH //invoke transport request handlers
+ level++; //AE_SERH
+
//invoke global request handlers
if (m_pGReqFChain)
{
if(AXIS_SUCCESS != (Status = m_pGReqFChain->Invoke(pMsg)))
{
- m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_CLIENTHANDLERFAILED));
+ //m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_CLIENTHANDLERFAILED));
break; //do .. while (0)
}
}
// AXISTRACE1("AFTER invoke global request handlers");
level++; //AE_GLH
+
+ //invoke transport request handlers
if (m_pTReqFChain) {
if(AXIS_SUCCESS != (Status = m_pTReqFChain->Invoke(pMsg)))
{
- m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_CLIENTHANDLERFAILED));
+ //m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_CLIENTHANDLERFAILED));
break; //do .. while (0)
}
}
// AXISTRACE1("AFTER invoke transport request handlers");
level++; // AE_TRH
-
- }
- while(0);
- */
-
- do
- {
if (AXIS_SUCCESS != (Status = m_pSZ->SetOutputStream(m_pSoap))) break;
m_pSZ->MarkEndOfStream();
+
+ level++; // AE_SERV
+
pMsg->setPastPivotState(true);
+
if (AXIS_SUCCESS != (Status = m_pDZ->SetInputStream(m_pSoap))) break;
- }
- while(0);
+
+ int nSoapVersion = m_pDZ->GetVersion();
+ if (nSoapVersion == VERSION_LAST) /* version not supported */
+ {
+ Status = AXIS_FAIL;
+ //return AXIS_FAIL;
+ }
+
+ m_pDZ->GetHeader();
- int nSoapVersion = m_pDZ->GetVersion();
- if (nSoapVersion == VERSION_LAST) /* version not supported */
- {
- Status = AXIS_FAIL;
- //return AXIS_FAIL;
}
+ while(0);
- m_pDZ->GetHeader();
/*
+ The case clauses in this switch statement have no breaks.
+ Hence, if Everything up to web service invocation was successful
+ then all response handlers are invoked. If there was a failure
+ at some point the response handlers from that point onwards
+ are invoked.
+ */
switch (level)
{
case AE_SERV: //everything success
Status = AXIS_SUCCESS;
//no break;
- case AE_SERH: //actual web service handler has failed
- //invoke web service specific response handlers
- if (m_pSResFChain)
+ case AE_TRH: //after invoking the transport handlers (at actual service invokation) it has failed
+ if (m_pTResFChain)
{
- m_pSResFChain->Invoke(pMsg);
+ m_pTResFChain->Invoke(pMsg);
}
//no break;
- case AE_GLH: //web service specific handlers have failed
+ case AE_GLH: //transport handlers have failed
//invoke global response handlers
if (m_pGResFChain)
{
m_pGResFChain->Invoke(pMsg);
}
//no break;
- case AE_TRH: //global handlers have failed
- if (m_pTResFChain)
+ case AE_SERH: //global handlers have failed
+ //invoke web service specific response handlers
+ if (m_pSResFChain)
{
- m_pTResFChain->Invoke(pMsg);
+ m_pSResFChain->Invoke(pMsg);
}
//no break;
- case AE_START:;//transport handlers have failed
+ case AE_START:;//service specific handlers have failed
};
- */
+
// AXISTRACE1("end axisengine process()");
return Status;
}
@@ -188,4 +196,23 @@
void ClientAxisEngine::OnFault(MessageData* pMsg)
{
+}
+
+char* ClientAxisEngine::get_service_name(const char* pch_uri_path)
+{
+ //return "InteropBaseDL";
+
+ char* pachTmp = strrchr(pch_uri_path, '/');
+
+ if (pachTmp != NULL) {
+ int iTmp = strlen(pachTmp);
+
+ if (iTmp <= 1) {
+ return NULL;
+ } else {
+ pachTmp = pachTmp +1;
+ }
+ }
+
+ return pachTmp;
}
1.41 +21 -4 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.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- Axis.cpp 31 Mar 2004 12:32:13 -0000 1.40
+++ Axis.cpp 31 Mar 2004 15:05:41 -0000 1.41
@@ -296,13 +296,30 @@
}
else if(bServer == 0)//client side module initialization
{
- #if defined(__AXISTRACE__)
- status = g_pAT->openFileByClient();
- if(status == AXIS_FAIL)
+ int status = g_pConfig->ReadConfFile();/*Read from the configuration file*/
+ if(status == AXIS_SUCCESS)
{
+ char* pClientWsddPath = g_pConfig->GetClientWsddFilePath();
+ if (AXIS_SUCCESS != g_pWSDDDeployment->LoadWSDD(pClientWsddPath)) return AXIS_FAIL;
+
+ #if defined(__AXISTRACE__)
+ status = g_pAT->openFileByClient();
+ if(status == AXIS_FAIL)
+ {
+ return AXIS_FAIL;
+ }
+ #endif
+ }
+ else
+ {
+ AXISTRACE1("Reading from the configuration file failed. " \
+ "Check for error in the configuration file", CRITICAL);
+ /*TODO:Improve the AxisTrace so that it will log
+ these kind of messages into a log file according to the
+ critical level specified.
+ */
return AXIS_FAIL;
}
- #endif
}
1.26 +2 -2 ws-axis/c/src/wsdd/WSDDDeployment.cpp
Index: WSDDDeployment.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/wsdd/WSDDDeployment.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- WSDDDeployment.cpp 30 Mar 2004 10:47:49 -0000 1.25
+++ WSDDDeployment.cpp 31 Mar 2004 15:05:41 -0000 1.26
@@ -165,13 +165,13 @@
if (AXIS_SUCCESS != doc->GetDeployment(sWSDD, this))
{
#ifdef _DEBUG
- printf("server.wsdd loading failed\n");
+ printf("wsdd loading failed\n");
#endif
delete doc;
return AXIS_FAIL;
}
#ifdef _DEBUG
- printf("server.wsdd loading successful\n");
+ printf("wsdd loading successful\n");
#endif
delete doc;
return AXIS_SUCCESS;