CGEM BOSS 6.6.5.i
BESIII Offline Software System
|
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) | |
virtual | ~XmlRpcClient () |
Destructor. | |
bool | execute (const char *method, XmlRpcValue const ¶ms, XmlRpcValue &result) |
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) |
Public Member Functions inherited from XmlRpc::XmlRpcSource | |
XmlRpcSource (int fd=-1, bool deleteOnClose=false) | |
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 [] |
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 | _request |
std::string | _header |
std::string | _response |
int | _sendAttempts |
int | _bytesWritten |
bool | _executing |
bool | _eof |
bool | _isFault |
int | _contentLength |
XmlRpcDispatch | _disp |
A class to send XML RPC requests to a server and return the results.
Definition at line 25 of file XmlRpcClient.h.
|
protected |
Enumerator | |
---|---|
NO_CONNECTION | |
CONNECTING | |
WRITE_REQUEST | |
READ_HEADER | |
READ_RESPONSE | |
IDLE |
Definition at line 86 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 |
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 |
Definition at line 30 of file XmlRpcClient.cpp.
|
virtual |
|
virtual |
Close the connection.
Reimplemented from XmlRpc::XmlRpcSource.
Definition at line 55 of file XmlRpcClient.cpp.
Referenced by doConnect(), and setupConnection().
|
protectedvirtual |
Definition at line 170 of file XmlRpcClient.cpp.
Referenced by setupConnection().
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 77 of file XmlRpcClient.cpp.
Referenced by main(), and JobInfoSvc::xmlrpc().
|
protectedvirtual |
Definition at line 240 of file XmlRpcClient.cpp.
Referenced by generateRequest().
|
protectedvirtual |
Definition at line 202 of file XmlRpcClient.cpp.
Referenced by execute().
|
virtual |
Handle server responses. Called by the event dispatcher during execute.
eventType | The type of event that occurred. |
Implements XmlRpc::XmlRpcSource.
Definition at line 115 of file XmlRpcClient.cpp.
|
inline |
Returns true if the result of the last execute() was a fault response.
Definition at line 61 of file XmlRpcClient.h.
Referenced by main().
|
protectedvirtual |
Definition at line 388 of file XmlRpcClient.cpp.
|
protectedvirtual |
Definition at line 286 of file XmlRpcClient.cpp.
Referenced by handleEvent().
|
protectedvirtual |
Definition at line 357 of file XmlRpcClient.cpp.
Referenced by handleEvent().
|
protectedvirtual |
Definition at line 145 of file XmlRpcClient.cpp.
Referenced by execute(), and readHeader().
|
protectedvirtual |
Definition at line 261 of file XmlRpcClient.cpp.
Referenced by handleEvent().
|
protected |
Definition at line 103 of file XmlRpcClient.h.
Referenced by handleEvent(), setupConnection(), and writeRequest().
|
protected |
Definition at line 87 of file XmlRpcClient.h.
Referenced by close(), execute(), handleEvent(), readHeader(), readResponse(), setupConnection(), writeRequest(), and XmlRpcClient().
|
protected |
Definition at line 116 of file XmlRpcClient.h.
Referenced by readHeader(), and readResponse().
|
protected |
Definition at line 119 of file XmlRpcClient.h.
Referenced by close(), execute(), and setupConnection().
|
protected |
Definition at line 110 of file XmlRpcClient.h.
Referenced by readHeader(), readResponse(), setupConnection(), and XmlRpcClient().
|
protected |
Definition at line 107 of file XmlRpcClient.h.
Referenced by execute(), and XmlRpcClient().
|
protected |
Definition at line 96 of file XmlRpcClient.h.
Referenced by readHeader(), and writeRequest().
|
protected |
Definition at line 90 of file XmlRpcClient.h.
Referenced by doConnect(), generateHeader(), and XmlRpcClient().
|
protected |
Definition at line 113 of file XmlRpcClient.h.
Referenced by execute(), isFault(), and parseResponse().
|
protected |
Definition at line 92 of file XmlRpcClient.h.
Referenced by doConnect(), generateHeader(), and XmlRpcClient().
|
protected |
Definition at line 95 of file XmlRpcClient.h.
Referenced by generateRequest(), and writeRequest().
|
protected |
Definition at line 97 of file XmlRpcClient.h.
Referenced by execute(), parseResponse(), readHeader(), readResponse(), and writeRequest().
|
protected |
Definition at line 100 of file XmlRpcClient.h.
Referenced by execute(), readHeader(), and writeRequest().
|
protected |
Definition at line 91 of file XmlRpcClient.h.
Referenced by generateHeader(), and XmlRpcClient().
|
static |
Definition at line 37 of file XmlRpcClient.h.
|
static |
Definition at line 36 of file XmlRpcClient.h.
Referenced by parseResponse().
|
static |
Definition at line 33 of file XmlRpcClient.h.
Referenced by generateRequest().
|
static |
Definition at line 32 of file XmlRpcClient.h.
Referenced by generateRequest(), and parseResponse().
|
static |
Definition at line 31 of file XmlRpcClient.h.
Referenced by generateRequest().
|
static |
Definition at line 30 of file XmlRpcClient.h.
Referenced by generateRequest(), and parseResponse().
|
static |
Definition at line 28 of file XmlRpcClient.h.
Referenced by generateRequest().
|
static |
Definition at line 34 of file XmlRpcClient.h.
Referenced by generateRequest().
|
static |
Definition at line 29 of file XmlRpcClient.h.
Referenced by generateRequest().