OverSim
|
A class to send XML RPC requests to a server and return the results. More...
#include <XmlRpcClient.h>
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. | |
XmlRpcClient (const char *host, int port, const char *uri=0, bool ssl=false) | |
XmlRpcClient (const char *host, int port, const char *login, const char *password, const char *uri=0) | |
Construct a client to connect to the server at the specified host:port address including HTTP authentication. | |
XmlRpcClient (const char *host, int port, const char *login, const char *password, const char *uri=0, bool ssl=false) | |
virtual | ~XmlRpcClient () |
Destructor. | |
bool | execute (const char *method, XmlRpcValue const ¶ms, 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. | |
const char *const | host () const |
Return the host name of the server. | |
int | getPort () const |
Return the port. | |
const char *const | uri () const |
Return the URI. | |
virtual void | close () |
Close the connection. | |
virtual unsigned | handleEvent (unsigned eventType) |
Handle server responses. | |
Public Member Functions inherited from XmlRpc::XmlRpcSource | |
XmlRpcSource (int fd=-1, bool deleteOnClose=false) | |
Constructor. | |
virtual | ~XmlRpcSource () |
Destructor. | |
int | getfd () const |
Return the file descriptor being monitored. | |
void | setfd (int fd) |
Specify the file descriptor to monitor. | |
bool | getKeepOpen () const |
Return whether the file descriptor should be kept open if it is no longer monitored. | |
void | setKeepOpen (bool b=true) |
Specify whether the file descriptor should be kept open if it is no longer monitored. |
Static Public Attributes | |
static const char | REQUEST_BEGIN [] = "<methodCall><methodName>" |
static const char | REQUEST_END_METHODNAME [] = "</methodName>\r\n" |
static const char | PARAMS_TAG [] = "<params>" |
static const char | PARAMS_ETAG [] = "</params>" |
static const char | PARAM_TAG [] = "<param>" |
static const char | PARAM_ETAG [] = "</param>" |
static const char | REQUEST_END [] = "</methodCall>\r\n" |
static const char | METHODRESPONSE_TAG [] = "<methodResponse>" |
static 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 ¶ms) |
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 | _login |
std::string | _password |
std::string | _request |
std::string | _header |
std::string | _response |
int | _sendAttempts |
int | _bytesWritten |
bool | _executing |
bool | _eof |
bool | _isFault |
int | _contentLength |
XmlRpcDispatch | _disp |
Additional Inherited Members | |
Public Attributes inherited from XmlRpc::XmlRpcSource | |
bool | _ssl |
SSL_CTX * | _ssl_ctx |
SSL * | _ssl_ssl |
SSL_METHOD * | _ssl_meth |
A class to send XML RPC requests to a server and return the results.
Definition at line 32 of file XmlRpcClient.h.
|
protected |
Definition at line 112 of file XmlRpcClient.h.
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.
host | The name of the remote machine hosting the server, eg "myserver.mycompany.com" |
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 Note that the host is not a URL, do not prepend "http://" or other protocol specifiers. |
Definition at line 37 of file XmlRpcClient.cc.
XmlRpcClient::XmlRpcClient | ( | const char * | host, |
int | port, | ||
const char * | uri = 0 , |
||
bool | ssl = false |
||
) |
Definition at line 55 of file XmlRpcClient.cc.
XmlRpcClient::XmlRpcClient | ( | const char * | host, |
int | port, | ||
const char * | login, | ||
const char * | password, | ||
const char * | uri = 0 |
||
) |
Construct a client to connect to the server at the specified host:port address including HTTP authentication.
host | The name of the remote machine hosting the server |
port | The port on the remote machine where the server is listening |
login | The username passed to the server |
password | The password passed to the server |
uri | An optional string to be sent as the URI in the HTTP GET header |
Definition at line 76 of file XmlRpcClient.cc.
XmlRpcClient::XmlRpcClient | ( | const char * | host, |
int | port, | ||
const char * | login, | ||
const char * | password, | ||
const char * | uri = 0 , |
||
bool | ssl = false |
||
) |
Definition at line 99 of file XmlRpcClient.cc.
|
virtual |
|
virtual |
Close the connection.
Reimplemented from XmlRpc::XmlRpcSource.
Definition at line 135 of file XmlRpcClient.cc.
|
protectedvirtual |
Definition at line 267 of file XmlRpcClient.cc.
bool XmlRpcClient::execute | ( | const char * | method, |
XmlRpcValue const & | params, | ||
XmlRpcValue & | result | ||
) |
Execute the named procedure on the remote server.
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 |
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.
Definition at line 171 of file XmlRpcClient.cc.
|
protectedvirtual |
Definition at line 351 of file XmlRpcClient.cc.
|
protectedvirtual |
Definition at line 313 of file XmlRpcClient.cc.
|
inline |
|
virtual |
Handle server responses.
Called by the event dispatcher during execute.
eventType | The type of event that occurred. |
Implements XmlRpc::XmlRpcSource.
Definition at line 208 of file XmlRpcClient.cc.
|
inline |
Return the host name of the server.
Definition at line 82 of file XmlRpcClient.h.
|
inline |
Returns true if the result of the last execute() was a fault response.
Definition at line 79 of file XmlRpcClient.h.
|
protectedvirtual |
Definition at line 528 of file XmlRpcClient.cc.
|
protectedvirtual |
Definition at line 426 of file XmlRpcClient.cc.
|
protectedvirtual |
Definition at line 497 of file XmlRpcClient.cc.
|
protectedvirtual |
Definition at line 242 of file XmlRpcClient.cc.
|
inline |
|
protectedvirtual |
Definition at line 401 of file XmlRpcClient.cc.
|
protected |
Definition at line 133 of file XmlRpcClient.h.
|
protected |
Definition at line 113 of file XmlRpcClient.h.
|
protected |
Definition at line 146 of file XmlRpcClient.h.
|
protected |
Definition at line 149 of file XmlRpcClient.h.
|
protected |
Definition at line 140 of file XmlRpcClient.h.
|
protected |
Definition at line 137 of file XmlRpcClient.h.
|
protected |
Definition at line 126 of file XmlRpcClient.h.
|
protected |
Definition at line 116 of file XmlRpcClient.h.
Referenced by host().
|
protected |
Definition at line 143 of file XmlRpcClient.h.
Referenced by isFault().
|
protected |
Definition at line 121 of file XmlRpcClient.h.
|
protected |
Definition at line 122 of file XmlRpcClient.h.
|
protected |
Definition at line 118 of file XmlRpcClient.h.
Referenced by getPort().
|
protected |
Definition at line 125 of file XmlRpcClient.h.
|
protected |
Definition at line 127 of file XmlRpcClient.h.
|
protected |
Definition at line 130 of file XmlRpcClient.h.
|
protected |
Definition at line 117 of file XmlRpcClient.h.
Referenced by uri().
|
static |
Definition at line 44 of file XmlRpcClient.h.
|
static |
Definition at line 43 of file XmlRpcClient.h.
|
static |
Definition at line 40 of file XmlRpcClient.h.
|
static |
Definition at line 39 of file XmlRpcClient.h.
|
static |
Definition at line 38 of file XmlRpcClient.h.
|
static |
Definition at line 37 of file XmlRpcClient.h.
|
static |
Definition at line 35 of file XmlRpcClient.h.
|
static |
Definition at line 41 of file XmlRpcClient.h.
|
static |
Definition at line 36 of file XmlRpcClient.h.