ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
XML_RPC2_Backend_Php_Response Class Reference
+ Collaboration diagram for XML_RPC2_Backend_Php_Response:

Static Public Member Functions

static encode ($param, $encoding= 'iso-8859-1')
 Encode a normal XML-RPC response, containing the provided value.
static encodeFault ($code, $message, $encoding= 'iso-8859-1')
 Encode a fault XML-RPC response, containing the provided code and message.
static decode (SimpleXMLElement $xml)
 Parse a response and either return the native PHP result.

Detailed Description

Definition at line 61 of file Response.php.

Member Function Documentation

static XML_RPC2_Backend_Php_Response::decode ( SimpleXMLElement  $xml)
static

Parse a response and either return the native PHP result.

This method receives an XML-RPC response document, in SimpleXML format, decodes it and returns the payload value.

Parameters
SimpleXmlElement$xmlThe Transport XML
Returns
mixed The response payload
See Also
http://www.xmlrpc.com/spec
Exceptions
XML_RPC2_FaultExceptionSignals the decoded response was an XML-RPC fault
XML_RPC2_DecodeExceptionSignals an ill formed payload response section

Definition at line 125 of file Response.php.

References XML_RPC2_Backend_Php_Value\createFromDecode(), and XML_RPC2_FaultException\createFromDecode().

Referenced by XML_RPC2_Backend_Php_Client\remoteCall___().

{
$faultNode = $xml->xpath('/methodResponse/fault');
if (count($faultNode) == 1) {
}
$paramValueNode = $xml->xpath('/methodResponse/params/param/value');
if (count($paramValueNode) == 1) {
return XML_RPC2_Backend_Php_Value::createFromDecode($paramValueNode[0])->getNativeValue();
}
throw new XML_RPC2_DecodeException('Unable to decode xml-rpc response. No fault nor params/param elements found');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static XML_RPC2_Backend_Php_Response::encode (   $param,
  $encoding = 'iso-8859-1' 
)
static

Encode a normal XML-RPC response, containing the provided value.

You may supply a php-native value, or an XML_RPC2_Backend_Php_Value instance, to be returned. Usually providing a native value is more convenient. However, for some types, XML_RPC2_Backend_Php_Value::createFromNative can't properly choose the xml-rpc type. In these cases, constructing an XML_RPC2_Backend_Php_Value and using it as param here is the only way to return the desired type.

See Also
http://www.xmlrpc.com/spec
XML_RPC2_Backend_Php_Value::createFromNative
Parameters
mixed$paramThe result value which the response will envelop
string$encodingencoding
Returns
string The XML payload

Definition at line 80 of file Response.php.

References $result, and XML_RPC2_Backend_Php_Value\createFromNative().

Referenced by XML_RPC2_Backend_Php_Server\getResponse().

{
if (!$param instanceof XML_RPC2_Backend_Php_Value) {
}
$result = '<?xml version="1.0" encoding="' . $encoding . '"?>';
$result .= '<methodResponse><params><param><value>' . $param->encode() . '</value></param></params></methodResponse>';
return $result;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static XML_RPC2_Backend_Php_Response::encodeFault (   $code,
  $message,
  $encoding = 'iso-8859-1' 
)
static

Encode a fault XML-RPC response, containing the provided code and message.

See Also
http://www.xmlrpc.com/spec
Parameters
int$codeResponse code
string$messageResponse message
string$encodingencoding
Returns
string The XML payload

Definition at line 102 of file Response.php.

References $result.

Referenced by XML_RPC2_Backend_Php_Server\getResponse(), and XML_RPC2_Backend_Xmlrpcext_Server\getResponse().

{
$value = new XML_RPC2_Backend_Php_Value_Struct(array('faultCode' => (int) $code, 'faultString' => (string) $message));
$result = '<?xml version="1.0" encoding="' . $encoding . '"?>';
$result .= '<methodResponse><fault><value>' . $value->encode() . '</value></fault></methodResponse>';
return $result;
}

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: