A bit more digging in ext/soap/soap.c and the set_soap_fault function reveals the other undocumented properties from the constructor:
<?php
try {
throw new SoapFault('code', 'string', 'actor', 'detail', 'name', 'header');
} catch (Exception $ex) {
var_dump($ex->faultcode, $ex->faultstring, $ex->faultactor, $ex->detail, $ex->_name, $ex->headerfault);
}
?>
The SoapFault class
(No version information available, might only be in SVN)
Introdução
Represents a SOAP fault.
Sinopse da classe
SoapFault
extends
Exception
{
/* Propriedades */
/* Métodos */
__construct
( string $faultcode
, string $faultstring
[, string $faultactor
[, string $detail
[, string $faultname
[, string $headerfault
]]]] )
SoapFault
( string $faultcode
, string $faultstring
[, string $faultactor
[, string $detail
[, string $faultname
[, string $headerfault
]]]] )
/* Métodos herdados */
}Propriedades
- message
-
Prop description
- code
-
Prop description
- file
-
Prop description
- line
-
Prop description
Índice
- SoapFault::__construct — SoapFault constructor
- SoapFault::SoapFault — SoapFault constructor
- SoapFault::__toString — Obtain a string representation of a SoapFault
chris AT cmbuckley DOT co DOT uk
13-May-2010 03:53
dmitry dot koterov at gmail dot com
29-Oct-2009 02:21
You may use undocumented and invisible property $e->faultcode to access string version of $code. Because standard $e->getCode() does not work:
<?php
$e = new SoapFault("test", "msg");
var_dump($e->getCode()); // prints "0"
var_dump($e->faultcode); // prints "test"
?>
Also you may use namespaced fault codes:
<?php
$e = new SoapFault(array("namespace", "test"), "msg");
?>
- see ext/soap/soap.php, PHP_METHOD(SoapFault, SoapFault). To access the namespace, use $e->faultcodens
