in src/engine/Axis.cpp [125:293]
STORAGE_CLASS_INFO int process_request(SOAPTransport* pStream)
{
int Status = AXIS_FAIL;
FILE* WsddFile = NULL;
char ReadBuffer[BYTESTOREAD];
ReadBuffer[0] = '\0';
const WSDDServiceMap* pSrvMap = NULL;
WSDDServiceMap::const_iterator iter;
WSDDService* pService = NULL;
/* If there is no transport object provided */
if (!pStream)
return AXIS_FAIL;
switch (pStream->getProtocol())
{
case APTHTTP1_1:
case APTHTTP1_0:
// Handle the POST method
if (AXIS_HTTP_POST == pStream->getSubProtocol())
{
AxisEngine *engine = new ServerAxisEngine ();
if (engine)
{
if (AXIS_SUCCESS == engine->initialize ())
{
try
{
Status = engine->process(pStream);
if (AXIS_SUCCESS == Status)
pStream->flushOutput();
else
{
ServerAxisEngine* pObjTempServer = (ServerAxisEngine*) engine;
pObjTempServer->setFaultOutputStream(Status, pStream);
pStream->flushOutput();
pObjTempServer = NULL;
Status = AXIS_SUCCESS;
}
}
catch(AxisException& e)
{
ServerAxisEngine* pObjTempServer = (ServerAxisEngine*) engine;
pObjTempServer->setFaultOutputStream(e, pStream);
pStream->flushOutput();
pObjTempServer = NULL;
Status = AXIS_SUCCESS;
}
}
delete engine;
}
}
else if (AXIS_HTTP_GET == pStream->getSubProtocol())
{
// get the uri path
// i.e "/abc/xyz/" part of http://somehost/abc/xyz/
string sUriWOAxis = pStream->getTransportProperty(SERVICE_URI);
string sServiceName;
bool bNoExt = true;
if (sUriWOAxis == "/")
{
bNoExt = false;
sUriWOAxis = "";
}
if (sUriWOAxis.empty ())
{
pSrvMap = g_pWSDDDeployment->getWSDDServiceMap ();
if (!pSrvMap)
{
// Samisa: the string continuation lines in the following
// code segments should *NOT* be indented
// in order to make sure the HTML is indented properly.
pStream->sendBytes("<html> \n\
\t<head>\n\
\t\t<title>Welcome to Axis C++</title>\n\
\t</head>\n\
\t<body>\n\
\t\t<h1 align=\"center\">Welcome to Axis C++</h1>\n\
\t\t<br>\n\
\t\t<h2>Deployment Descriptor Not Found</h2>\n\
\t\t<br>\n\
\t</body>\n\
</html>\n", NULL);
return AXIS_FAIL;
}
pStream->sendBytes("<html>\n\
\t<head>\n\
\t\t<title>Welcome to Axis C++</title>\n\
\t</head>\n\
\t<body>\n\
\t\t<h1 align=\"center\">Welcome to Axis C++</h1>\n\
\t\t<br>\n\
\t\t<h2 align=\"center\">List of Deployed Web services</h2>\n\
\t\t<br>\n\
\t\t<table width=\"100%\" border=1 align=\"center\">\n\
\t\t\t<tbody>\n", NULL);
pStream->sendBytes
("\t\t\t\t<tr>\n\
\t\t\t\t\t<td width=\"20%\"><b>Web Service</b></td>\n\
\t\t\t\t\t<td width=\"10%\" align=\"left\"><b>WSDL</b></td>\n\
\t\t\t\t\t<td width=\"70%\"><b>Description</b></td>\n\
\t\t\t\t</tr>\n", NULL);
for (iter = pSrvMap->begin (); iter != pSrvMap->end ();
iter++)
{
pService = (*iter).second;
pStream->sendBytes("\t\t\t\t<tr>\n\
\t\t\t\t\t<td width=\"20%\">", NULL);
pStream->sendBytes((char*) pService->
getServiceName (), NULL);
pStream->sendBytes
("</td>\n\
\t\t\t\t\t<td width=\"10%\" align=\"left\">\n\
\t\t\t\t\t\t<a href=\"./",
NULL);
//if (bNoExt) pStream->sendBytes("axis/", NULL);
pStream->sendBytes((char*) pService->
getServiceName (), NULL);
pStream->sendBytes("?wsdl", NULL);
pStream->sendBytes("\">wsdl</a>\n\
\t\t\t\t\t</td>\n\
\t\t\t\t\t<td width=\"70%\">", NULL);
pStream->sendBytes((char*) pService->
getDescription (), NULL);
pStream->sendBytes("</td>\n\
\t\t\t\t</tr>\n", NULL);
}
pStream->sendBytes("\t\t\t</tbody>\n\
\t\t</table>\n", NULL);
pStream->sendBytes
("\t\t<br><p align=\"center\">Copyright 2001-2003 The Apache Software Foundation<br></p>\n\t</body>\n</html>\n", NULL);
Status = AXIS_SUCCESS;
}
else
{
sServiceName = g_pConfig->getAxisConfProperty(AXCONF_AXISHOME);
sServiceName += WSDLDIRECTORY + sUriWOAxis + ".wsdl";
// Check whether wsdl file is available
if ((WsddFile = fopen (sServiceName.c_str (), "r")) == NULL)
{
pStream->sendBytes("<h3>Url not available</h3>", NULL);
Status = AXIS_SUCCESS;
}
else
{
int charcount = 0;
while ((charcount = fread (ReadBuffer, 1, BYTESTOREAD - 1, WsddFile)) != 0)
{
*(ReadBuffer + charcount) = '\0';
pStream->sendBytes(ReadBuffer, NULL);
}
Status = AXIS_SUCCESS;
fclose (WsddFile);
}
}
}
break;
default:
pStream->sendBytes("Unknown Protocol", NULL);
break;
}
return Status;
}