tags:

views:

118

answers:

1

Hi, I have a small "SOAP CGI gatewqay" C++ program that reads an HTTP SOAP request from cin, get the request info from it and sends it to the legacy server. Then it taks the response, format it as a SOAP response and write it to cout.

In case of an error, it writes a <SOAP-ENV:Fault> reponse to cout. However, the SOAP standard says that in case of error, the returned HTTP status should be 500 "Internal Server Error". This SOAP CGI gateway should run on any web server that supports CGI. What is the proper way to set the HTTP status returned by the web server when the CGI returns?

Thanks, splintor

+2  A: 

You write a "Status: 500 Internal Server Error" to the headers. This has to be written before any content is written of course.

Williham Totland
splintor
It is, as I recall, part of the CGI standard, so it'd be a safe bet.
Williham Totland
@splintor: See section 6.3.3 of RFC 3875: http://www.ietf.org/rfc/rfc3875
RichieHindle
@RichieHindle, Williham Totland: Great, thanks.
splintor