XMLRPC Server Faults

Encapsulates an exception for use as an XMLRPC fault response. Valid exception classes that may be used for generating the fault code and fault string can be attached using attachFaultException(); all others use a generic '404 Unknown error' response.

You may also attach fault observers, which would allow you to monitor particular fault cases; this is done via attachObserver(). Observers need only implement a static 'observe' method.

To allow method chaining, you may use the getInstance() factory to instantiate a Zend\XmlRpc\Server\Fault.

 Methods

Constructor

__construct(\Exception $e) : \Zend\XmlRpc\Server\Fault

Parameters

Returns

Return XML fault response

__toString() : string
Inherited

inherited_from \Zend\XmlRpc\Fault::__toString()

Returns

string

Attach valid exceptions that can be used to define xmlrpc faults

attachFaultException(string | array $classes) : void

Parameters

$classes

stringarray

Class name or array of class names

Attach an observer class

attachObserver(string $class) : bool

Allows observation of xmlrpc server faults, thus allowing logging or mail notification of fault responses on the xmlrpc server.

Expects a valid class name; that class must have a public static method 'observe' that accepts an exception as its sole argument.

Parameters

$class

string

Returns

bool

Detach fault exception classes

detachFaultException(string | array $classes) : void

Parameters

$classes

stringarray

Class name or array of class names

Detach an observer

detachObserver(string $class) : bool

Parameters

$class

string

Returns

bool

Return fault code

getCode() : int
Inherited

inherited_from \Zend\XmlRpc\Fault::getCode()

Returns

int

Retrieve current fault encoding

getEncoding() : string
Inherited

inherited_from \Zend\XmlRpc\Fault::getEncoding()

Returns

string

Retrieve the exception

getException() : \Exception

access public

Returns

Return Zend\XmlRpc\Server\Fault instance

getInstance(\Exception $e) : \Zend\XmlRpc\Server\Fault

Parameters

Returns

Retrieve fault message

getMessage() : string
Inherited

inherited_from \Zend\XmlRpc\Fault::getMessage()

Returns

string

Determine if an XML response is an XMLRPC fault

isFault(string $xml) : bool
Inherited

inherited_from \Zend\XmlRpc\Fault::isFault()

Parameters

$xml

string

Returns

bool

Load an XMLRPC fault from XML

loadXml(string $fault) : bool
Inherited

inherited_from \Zend\XmlRpc\Fault::loadXml()

Parameters

$fault

string

Exceptions

\Zend\XmlRpc\Exception\ExceptionInterface if no or faulty XML provided, or if fault response does not contain either code or message

Returns

boolReturns true if successfully loaded fault response, false if response was not a fault response

Serialize fault to XML

saveXml() : string
Inherited

inherited_from \Zend\XmlRpc\Fault::saveXml()

Returns

string

Set the fault code

setCode(int $code) : \Zend\XmlRpc\Fault
Inherited

inherited_from \Zend\XmlRpc\Fault::setCode()

Parameters

$code

int

Returns

Set encoding to use in fault response

setEncoding(string $encoding) : \Zend\XmlRpc\Fault
Inherited

inherited_from \Zend\XmlRpc\Fault::setEncoding()

Parameters

$encoding

string

Returns

Retrieve fault message

setMessage($message) : \Zend\XmlRpc\Fault
Inherited

inherited_from \Zend\XmlRpc\Fault::setMessage()

Parameters

$message

string

Returns

 Properties

 

Fault code

$code : int
Inherited

inherited_from \Zend\XmlRpc\Fault::$$code
 

Fault character encoding

$encoding : string
Inherited

inherited_from \Zend\XmlRpc\Fault::$$encoding
 

$exception

$exception : \Exception

 

<p>Array of exception classes that may define xmlrpc faults</p>

$faultExceptionClasses : array

 

Internal fault codes => messages

$internal : array
Inherited

inherited_from \Zend\XmlRpc\Fault::$$internal
 

Fault message

$message : string
Inherited

inherited_from \Zend\XmlRpc\Fault::$$message
 

<p>Array of fault observers</p>

$observers : array