php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43507 SOAPFault HTTP Status 500 - would like to be able to set the HTTP Status
Submitted: 2007-12-05 19:05 UTC Modified: 2008-02-15 06:53 UTC
Votes:14
Avg. Score:4.2 ± 0.9
Reproduced:11 of 11 (100.0%)
Same Version:8 (72.7%)
Same OS:2 (18.2%)
From: ianils at gmail dot com Assigned: dmitry (profile)
Status: Closed Package: SOAP related
PHP Version: 5.2.5 OS:
Private report: No CVE-ID: None
 [2007-12-05 19:05 UTC] ianils at gmail dot com
Description:
------------
When using php web services with Adobe Flex/Flash/AIR , error handling is a major pain. 

If I have a simple web service that throws a SOAPFault , the http status code that is returned with the message is 500 .  This is a problem because the Flash Player ignores any message that has a status code > 200.  ( Which is understandable , status code 500 could mean the server is really in trouble ) . 

I would very much like to be able to set the 'status code' that is returned when a SOAP Fault is thrown . 

The flash player is clever enough to recognize a SOAP Error and therefore able to run the correct code from with the flash app , however this is only possible when it gets a HTTP Status code that is not > 200.



Reproduce code:
---------------
This is a feature request to be able to set the HTTP Error code that is returned from a SOAP Fault . 
Its not necessarily a bug with a PHP , other languages offer similar workarounds.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-02-14 16:30 UTC] dmitry@php.net
I am able to disable HTTP 500 status code for some user agents, but I don't know the exactly user agent strings.

Flash - "Shockwave Flash"
Flex  - ?
AIR   - ?
 [2008-02-15 05:49 UTC] ianils at gmail dot com
The user agent is the same for Flex and AIR ie. "Shockwave Flash" 

However it is possible to change the userAgent from with in side 
the Flash/Flex/Air app . 

Is it possible to set the  status via the SOAP call itself ?

eg:
SoapServer->setFaultStatusCode($status=500) 

perhaps ??
 [2008-02-15 06:53 UTC] dmitry@php.net
It makes no sense to setup status code manually (for all clients), because HTTP 500 is legal response.
I've committed the fix based on User-Agent header.
 [2010-12-15 15:11 UTC] wpoi at ya dot ru
Problem do still exist. While PHP sends 200 HTTP code for SOAP Fault with User-agent = Shockwave Flash, Flash objects integrated into HTML page sends it's requests with User-agent = browser and NOT Shockwave Flash.

Thus Flash object still receive 500 Error.
 [2016-02-13 05:39 UTC] hasanmuhdlor at yahoo dot com
https://free.facebook.com/hasan.muhdlor?v=feed&_rdr
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC