Class Request

Summary

Fully Qualified Name: Laminas\XmlRpc\Request

Description

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 {@link $fault}; developers may check for it using {@link isFault()} and {@link getFault()}.

Methods

Name Description Defined By
__construct() Create a new XML-RPC request Request
__toString() Return XML request Request
addParam() Add a parameter to the parameter stack Request
getEncoding() Retrieve current request encoding Request
getFault() Retrieve the fault response, if any Request
getMethod() Retrieve call method Request
getParams() Retrieve the array of parameters Request
getTypes() Return parameter types Request
isFault() Does the current request contain errors and should it return a fault response? Request
loadXml() Load XML and parse into request components Request
saveXml() Create XML request Request
setEncoding() Set encoding to use in request Request
setMethod() Set method to call Request
setParams() Set the parameters array Request

Method Details

__construct()

Create a new XML-RPC request

Parameter Name Type Description
$method string (optional)
$params array (optional)

Returns:

__toString()

Return XML request

Returns: string

addParam()

Add a parameter to the parameter stack

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

Parameter Name Type Description
$value mixed
$type string Optional;

Returns: void

getEncoding()

Retrieve current request encoding

Returns: string

getFault()

Retrieve the fault response, if any

Returns: null|\Laminas\XmlRpc\Fault

getMethod()

Retrieve call method

Returns: string

getParams()

Retrieve the array of parameters

Returns: array

getTypes()

Return parameter types

Returns: array

isFault()

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

Returns: bool

loadXml()

Load XML and parse into request components

Parameter Name Type Description
$request string

Returns: bool True on success, false if an error occurred.

saveXml()

Create XML request

Returns: string

setEncoding()

Set encoding to use in request

Parameter Name Type Description
$encoding string

Returns: \Laminas\XmlRpc\Request

setMethod()

Set method to call

Parameter Name Type Description
$method string

Returns: bool Returns true on success, false if method name is invalid

setParams()

Set the parameters array

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
)[, ... ]

);

Returns: void

Top