This class provides a representation for a request to an XML-RPC server. A client sends an xmlrpcmsg
to a server, and receives back an xmlrpcresp
(see xmlrpc_client->send).
The constructor takes the following form:
$msg=new xmlrpcmsg( | $methodName, | |
$parameterArray) ; |
$methodName; | |
$parameterArray; |
Where methodName
is a string indicating the name of the method you wish to invoke, and parameterArray
is a simple Array
of xmlrpcval
objects. Here's an example message to the US state name server:
$msg=new xmlrpcmsg("examples.getStateName", array(new xmlrpcval(23, "int")));
This example requests the name of state number 23. For more information on xmlrpcval
objects, see xmlrpcval.
$outString=$msg->serialize(
)
;
;
Returns the an XML string representing the XML-RPC message.
$msg->addParam(
$xmlrpcVal)
;$xmlrpcVal
;
Adds the xmlrpcval
xmlrpcVal
to the parameter list for this method call.
$xmlrpcVal=$msg->getParam(
$n)
;$n
;
Gets the n
th parameter in the message. Use this method in server implementations. Returns the undef
value if no such parameter exists.
$n=$msg->getNumParams(
)
;
;
Returns the number of parameters attached to this message.
$methName=$msg->method(
)
;
;
$msg->method(
$methName)
;$methName
;
Gets or sets the method contained in the XML-RPC message.
$response=$msg->parseResponse(
$xmlString)
;$xmlString
;
Given an incoming XML-RPC server response contained in the string $xmlString
, this method constructs an xmlrpcresp
response object and returns it, setting error codes as appropriate (see xmlrpc_client->send).
This method processes any HTTP/MIME headers it finds.
$response=$msg->parseResponseFile( | $fileHandle) ; |
$fileHandle; |
Given an incoming XML-RPC server response on the file handle fileHandle
, this method reads the data and passes it to parseResponse
This method is useful to construct responses from pre-prepared files (see files demo1.txt, demo2.txt, demo3.txt
in this distribution). It processes any HTTP headers it finds.