I'm developing a webserver(FCGI) based on using gsoap v2.8. This webserver shall respond to the incoming HTTP GET requests but it's not working.
I got to know that gsoap provides HTTP callbacks to achieve this, In my case I'm using soap->fget callback. I went through the gsoap documentation and I'm following the same.
I understand that whenever there is a incoming HTTP GET requests, the soap_serve (generated by gsoap) function shall call fget callback function but I see that my function http_get is not getting hit and soap_serve is returning -1 with error message "Response-Header: \nHTTP/1.1 500 Internal Server Error\r\nServer:"
I'm not sure if anything to be corrected/added in my code to handle HTTP GET requests by my webserver.
Any quick response will really help me. Thank you in advance.
The
fget()callback is not invoked when FCGI or CGI is used, because the HTTP headers are stripped from the inbound message. Therefore,soap_serve()assumes this is a POST request by default. To respond to GET requests, do not callsoap_serve()right away. Check the environment variableREQUEST_METHODisGETand then produce the corresponding output. Check if the environment variablePATH_INFOorPATH_TRANSLATEDandQUERY_STRINGmatch the URL your service should respond to. Never return files located on the server that are identified byPATH_INFOor byQUERY_STRING, which is a security risk. Only return files or output that should be publicly visible.