This function also sends a 500 response code back to the client with the request.
This was causing issues with an Apache Axis 1.2 client I had so I instead implemented by own fault handling:
header("Content-Type: text/xml");
header("Status: 200");
die("<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>500</faultcode>
<faultstring>".$ex->getMessage())."</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>");
SoapServer::fault
(PHP 5 >= 5.0.1)
SoapServer::fault — Issue SoapServer fault indicating an error
Description
public void SoapServer::fault
( string $code
, string $string
[, string $actor
[, string $details
[, string $name
]]] )
Sends a response to the client of the current request indicating an error.
Note:
This can only be called when handling a request.
Parameters
- code
-
The error code to return
- string
-
A brief description of the error
- actor
-
A string identifying the actor that caused the fault.
- details
-
More details of the fault
- name
-
The name of the fault. This can be used to select a name from a WSDL file.
Return Values
No value is returned.
dub357 at gmail dot com
08-Feb-2012 08:01
Amr Mostafa
09-Sep-2009 06:16
This function currently terminates execution as well, which may be undesirable. See: http://bugs.php.net/bug.php?id=49513
Anonymous
16-Jul-2008 12:12
If you use Adobe Flex, Flash or AIR as SOAP client and are unable to get the error message in case of a soap fault, upgrade to PHP 5.2.6.
Details in:
http://bugs.php.net/bug.php?id=43507
