xmlrpcresp
Prev | Chapter 7. Class documentation | Next

## xmlrpcresp

This class is used to contain responses to XML-RPC requests. A server method handler will construct an `xmlrpcresp` and pass it as a return value. This same value will be returned by the result of an invocation of the `send` method of the `xmlrpc_client` class.

### Creation

`xmlrpcrespnew xmlrpcresp(` | xmlrpcval$xmlrpcval`)`;

`xmlrpcrespnew xmlrpcresp(` | 0,
| int$errcode,
| string$err_string`)`;

The first syntax is used when execution has happened without difficulty: `$xmlrpcval` is an `xmlrpcval` value with the result of the method execution contained in it. Alternatively it can be a string containing the xml serialization of the single xml-rpc value result of method execution.

The second type of constructor is used in case of failure. `errcode` and `err_string` are used to provide indication of what has gone wrong. See xmlrpc_server for more information on passing error codes.

### Methods

#### faultCode

`intfaultCode(` | `void)`; |

Returns the integer fault code return from the XML-RPC response. A zero value indicates success, any other value indicates a failure response.

#### faultString

`stringfaultString(` | `void)`; |

Returns the human readable explanation of the fault indicated by `$resp->faultCode`().

#### value

`xmlrpcvalvalue(` | `void)`; |

Returns an `xmlrpcval` object containing the return value sent by the server. If the response's `faultCode` is non-zero then the value returned by this method should not be used (it may not even be an object).

Note: if the xmlrpcresp instance in question has been created by an `xmlrpc_client` object whose `return_type` was set to 'phpvals', then a plain php value will be returned instead of an `xmlrpcval` object. If the `return_type` was set to 'xml', an xml string will be returned (see the return_type member var above for more details).

#### serialize

`stringserialize(` | `void)`; |

Returns an XML string representation of the response (xml prologue not included).

Prev | Up | Next
xmlrpc_client | Home | xmlrpc_server