QXmlRPC
1.1
|
The xmlrpc::Server class provides an implementation of the XML-RPC server. More...
#include <server.h>
Public Slots | |
void | sendReturnValue (int requestId, const xmlrpc::Variant &value) |
void | sendFault (int requestId, int faultCode, QString faultMessage) |
Signals | |
void | incomingRequest (int requestId, QString methodName, QList< xmlrpc::Variant > parameters) |
Public Member Functions | |
Server (QObject *parent=0) | |
virtual | ~Server () |
bool | listen (quint16 port, const QHostAddress &address=QHostAddress::Any) |
bool | isListening () const |
void | registerMethod (QString methodName, QVariant::Type returnType, QList< QVariant::Type > parameterTypes) |
void | registerMethod (QString methodName, QVariant::Type returnType) |
void | registerMethod (QString methodName, QVariant::Type returnType, QVariant::Type parameter1Type) |
void | registerMethod (QString methodName, QVariant::Type returnType, QVariant::Type parameter1Type, QVariant::Type parameter2Type) |
void | registerMethod (QString methodName, QVariant::Type returnType, QVariant::Type parameter1Type, QVariant::Type parameter2Type, QVariant::Type parameter3Type) |
void | registerMethod (QString methodName, QVariant::Type returnType, QVariant::Type parameter1Type, QVariant::Type parameter2Type, QVariant::Type parameter3Type, QVariant::Type parameter4Type) |
Protected Slots | |
void | newConnection () |
void | processRequest (QByteArray data, QTcpSocket *socket) |
Friends | |
class | IncomingConnection |
The xmlrpc::Server class provides an implementation of the XML-RPC server.
xmlrpc::Server::Server | ( | QObject * | parent = 0 | ) |
Create new xmlrpc::Server instance.
|
virtual |
Delete xmlrpc::Server instance.
bool xmlrpc::Server::isListening | ( | ) | const |
Returns true if the server is currently listening for incoming connections; otherwise returns false.
bool xmlrpc::Server::listen | ( | quint16 | port, |
const QHostAddress & | address = QHostAddress::Any |
||
) |
Tells the server to listen for incoming connections on address address and port port. If address is QHostAddress::Any, the server will listen on all network interfaces.
Returns true on success; otherwise returns false.
|
protectedslot |
Parse incoming request, and emit incomingRequest() signal or return xmlrpc response back to socket
References xmlrpc::Request::methodName(), xmlrpc::Request::parameters(), sendFault(), sendReturnValue(), and xmlrpc::Request::setContent().
void xmlrpc::Server::registerMethod | ( | QString | methodName, |
QVariant::Type | returnType, | ||
QList< QVariant::Type > | parameterTypes | ||
) |
Register method methodName as supported by this server instance.
This allows the server to provide information about methods, parameters and return values to clients.
This data is also used to perform checks for supported methodNames and parameter types before incomingRequest() signal is emited. This allows to remove types checks from the methods implementation and avoid of possible bugs.
Methods registration is optional, but if at least one method is registered, all other have to be registered too, since this data will be used for method names checks.
Warning: only top level types are checked. For example if some method has two parametrs: int and QList<double>. Type of the first parameter will be checked, but the second parameter will be only checked to be a list, but type of items in the list must be checked in the implementation of this method.
Referenced by registerMethod().
void xmlrpc::Server::registerMethod | ( | QString | methodName, |
QVariant::Type | returnType | ||
) |
This is an overloaded member function, provided for convenience.
References registerMethod().
void xmlrpc::Server::registerMethod | ( | QString | methodName, |
QVariant::Type | returnType, | ||
QVariant::Type | parameter1Type | ||
) |
This is an overloaded member function, provided for convenience.
References registerMethod().
void xmlrpc::Server::registerMethod | ( | QString | methodName, |
QVariant::Type | returnType, | ||
QVariant::Type | parameter1Type, | ||
QVariant::Type | parameter2Type | ||
) |
This is an overloaded member function, provided for convenience.
References registerMethod().
void xmlrpc::Server::registerMethod | ( | QString | methodName, |
QVariant::Type | returnType, | ||
QVariant::Type | parameter1Type, | ||
QVariant::Type | parameter2Type, | ||
QVariant::Type | parameter3Type | ||
) |
This is an overloaded member function, provided for convenience.
References registerMethod().
void xmlrpc::Server::registerMethod | ( | QString | methodName, |
QVariant::Type | returnType, | ||
QVariant::Type | parameter1Type, | ||
QVariant::Type | parameter2Type, | ||
QVariant::Type | parameter3Type, | ||
QVariant::Type | parameter4Type | ||
) |
This is an overloaded member function, provided for convenience.
References registerMethod().
|
slot |
Send exception ( faultCode and faultMessage ) back to client.
requestId | id of the request, provided by incomingRequest() signal |
Referenced by processRequest().
|
slot |
Send method return value back to client.
requestId | id of the request, provided by incomingRequest() signal |
value | to be returned to client |
References xmlrpc::Response::composeResponse().
Referenced by processRequest().