Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Return HTTP Status 200 OK rather than 500.



1:11 pm on Sep 9, 2011 (gmt 0)

Hello Everyone.

I have a device that refuses to communicate and parse HTML unless it gets a 200 OK HTTP Status code.

unfortunately for me.. this device hits a page I made that also makes a SOAP call to a WSDL file.

If the SOAP calls gets a SOAP Fault, not necessarily an error.. in my case it's a "user already exists" error, that I can catch, it turn the entire page into a HTTP 500 Internal server Error.

I have tried all of these, and for some reason the page still loads a 500 status when I use Firefox Web Console to watch whats going on.

header('HTTP/1.1 200 OK');
header("Status: 200");

Perhaps I'm not wrapping the error properly or I'm not catching and cleaning whats going on..

here is an example of how I'm trying to handle everything.

//Open SOAP WSDL Connection
$client = @new SoapClient('https://site.com/ClockService.svc?wsdl', array('cache_wsdl' => 0));
// Request a authentication ticket GUID
$tixparam = array('userName'=>'user', 'password'=>'Password');
$getauth = $client->Authenticate($tixparam);
$authkey = $getauth->AuthenticateResult;
//Give the WSDL the received ticket and prepare a request.
$param = array('ticket'=>$authkey);
// Do a Human Readable dump of the Object Array,
echo "<pre>".print_r($param, true)."</pre><br>";
//Deal with Faults
catch (SoapFault $doapunch) {
header('HTTP/1.1 200 OK');
header("Status: 200 OK");
// Do a Human Readable dump of the Object Array,
echo "<pre>".print_r($param, true)."</pre><br>";
trigger_error("SOAP Fault: (faultItem: {$doapunch->detail->ValidationFault->Messages->KeyValueOfstringstring->Key}, faultstring: {$doapunch->detail->ValidationFault->Messages->KeyValueOfstringstring->Value})", E_USER_ERROR);

I have also tried putting the header info at the top or at the verry bottom of the page..
What am I doing wrong?
Should I go about this via a different method like mod_rewrite in the .htaccess?

Thank you all kindly for your input.


6:41 pm on Sep 12, 2011 (gmt 0)

5+ Year Member

I didn't see anybody respond (it's a tough one), so I offer this in case it helps:

Have you tried isolating the header calls, with just a page that sets the header. Can you make the header do whatever you want? Make it a 500 when it should be 200, make it a 404 when the page is found?

Hope that helps...

Featured Threads

Hot Threads This Week

Hot Threads This Month