XmlRpc Request object

Encapsulates an XmlRpc request, holding the method call and all parameters. Provides accessors for these, as well as the ability to load from XML and to create the XML request string.

Additionally, if errors occur setting the method or parsing XML, a fault is generated and stored in $fault; developers may check for it using isFault() and getFault().

category Zend
package Zend_XmlRpc

 Methods

Create a new XML-RPC request

__construct(string $method, array $params) 

Parameters

$method

string

(optional)

$params

array

(optional)

Return XML request

__toString() : string

Returns

string

Add a parameter to the parameter stack

addParam(mixed $value, string $type) : void

Adds a parameter to the parameter stack, associating it with the type $type if provided

Parameters

$value

mixed

$type

string

Optional; type hinting

Retrieve current request encoding

getEncoding() : string

Returns

string

Retrieve the fault response, if any

getFault() : null | \Zend\XmlRpc\Fault

Returns

Retrieve call method

getMethod() : string

Returns

string

Retrieve the array of parameters

getParams() : array

Returns

array

Return parameter types

getTypes() : array

Returns

array

Does the current request contain errors and should it return a fault response?

isFault() : bool

Returns

bool

Load XML and parse into request components

loadXml(string $request) : bool

Parameters

$request

string

Exceptions

\Zend\XmlRpc\Exception\ValueException if invalid XML

Returns

boolTrue on success, false if an error occurred.

Create XML request

saveXml() : string

Returns

string

Set encoding to use in request

setEncoding(string $encoding) : \Zend\XmlRpc\Request

Parameters

$encoding

string

Returns

Set method to call

setMethod(string $method) : bool

Parameters

$method

string

Returns

boolReturns true on success, false if method name is invalid

Set the parameters array

setParams() : void

If called with a single, array value, that array is used to set the parameters stack. If called with multiple values or a single non-array value, the arguments are used to set the parameters stack.

Best is to call with array of the format, in order to allow type hinting when creating the XMLRPC values for each parameter:

$array = array(
    array(
        'value' => $value,
        'type'  => $type
    )[, ... ]
);

access public

Retrieve method parameters as XMLRPC values

_getXmlRpcParams() : array

Returns

array

 Properties

 

Request character encoding

$encoding : string

 

Fault object, if any

$fault : \Zend\XmlRpc\Fault

 

Method to call

$method : string

 

Method parameters

$params : array

 

XML-RPC type for each param

$types : array

 

XML request

$xml : string

 

XML-RPC request params

$xmlRpcParams : array