Main Page   Class Hierarchy   Compound List   File List   Compound Members  

XmlRpc::XmlRpcClient Class Reference

A class to send XML RPC requests to a server and return the results. More...

#include <XmlRpcClient.h>

Inheritance diagram for XmlRpc::XmlRpcClient:

XmlRpc::XmlRpcSource List of all members.

Public Member Functions

 XmlRpcClient (const char *host, int port, const char *uri=0)
 Construct a client to connect to the server at the specified host:port address.

virtual ~XmlRpcClient ()
 Destructor.

bool execute (const char *method, XmlRpcValue const &params, XmlRpcValue &result)
 Execute the named procedure on the remote server.

bool isFault () const
 Returns true if the result of the last execute() was a fault response.

virtual void close ()
 Close the connection.

virtual unsigned handleEvent (unsigned eventType)
 Handle server responses.


Static Public Attributes

const char REQUEST_BEGIN []
const char REQUEST_END_METHODNAME [] = "</methodName>\r\n"
const char PARAMS_TAG [] = "<params>"
const char PARAMS_ETAG [] = "</params>"
const char PARAM_TAG [] = "<param>"
const char PARAM_ETAG [] = "</param>"
const char REQUEST_END [] = "</methodCall>\r\n"
const char METHODRESPONSE_TAG [] = "<methodResponse>"
const char FAULT_TAG [] = "<fault>"

Protected Types

enum  ClientConnectionState {
  NO_CONNECTION, CONNECTING, WRITE_REQUEST, READ_HEADER,
  READ_RESPONSE, IDLE
}

Protected Member Functions

virtual bool doConnect ()
virtual bool setupConnection ()
virtual bool generateRequest (const char *method, XmlRpcValue const &params)
virtual std::string generateHeader (std::string const &body)
virtual bool writeRequest ()
virtual bool readHeader ()
virtual bool readResponse ()
virtual bool parseResponse (XmlRpcValue &result)

Protected Attributes

ClientConnectionState _connectionState
std::string _host
std::string _uri
int _port
std::string _request
std::string _header
std::string _response
int _sendAttempts
int _bytesWritten
bool _executing
bool _eof
bool _isFault
int _contentLength
XmlRpcDispatch _disp

Detailed Description

A class to send XML RPC requests to a server and return the results.


Constructor & Destructor Documentation

XmlRpcClient::XmlRpcClient const char *    host,
int    port,
const char *    uri = 0
 

Construct a client to connect to the server at the specified host:port address.

Parameters:
host The name of the remote machine hosting the server
port The port on the remote machine where the server is listening
uri An optional string to be sent as the URI in the HTTP GET header


Member Function Documentation

bool XmlRpcClient::execute const char *    method,
XmlRpcValue const &    params,
XmlRpcValue   result
 

Execute the named procedure on the remote server.

Parameters:
method The name of the remote procedure to execute
params An array of the arguments for the method
result The result value to be returned to the client
Returns:
true if the request was sent and a result received (although the result might be a fault).
Currently this is a synchronous (blocking) implementation (execute does not return until it receives a response or an error). Use isFault() to determine whether the result is a fault response.

unsigned XmlRpcClient::handleEvent unsigned    eventType [virtual]
 

Handle server responses.

Called by the event dispatcher during execute.

Parameters:
eventType The type of event that occurred.
See also:
XmlRpcDispatch::EventType

Implements XmlRpc::XmlRpcSource.


Member Data Documentation

const char XmlRpcClient::REQUEST_BEGIN [static]
 

Initial value:

 
  "<?xml version=\"1.0\"?>\r\n"
  "<methodCall><methodName>"


The documentation for this class was generated from the following files:
Generated on Thu Mar 6 11:32:58 2003 for XmlRpc++ by doxygen1.3-rc3