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>");
Description
public void SoapServer::fault
( string $code
, string $string
[, string $actor
[, string $details
[, string $name
]]] )
Envoie une réponse au client de la requête courante, avec un message d'erreur.
Note:
Cela n'est possible que durant l'exécution de la requête.
Liste de paramètres
- code
-
Le code d'erreur à retourner.
- string
-
Une description de l'erreur.
- actor
-
Une chaîne identifiant l'acteur en cause.
- details
-
Plus de détails sur la faute.
- name
-
Le nom de l'erreur. Cela peut être utilisé pour sélectionner un nom dans un fichier WSDL.
Valeurs de retour
Aucune valeur n'est retournée.
dub357 at gmail dot com
08-Feb-2012 09:01
Amr Mostafa
09-Sep-2009 08: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 02: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
