![]() |
KD SOAP API Documentation
2.1
|
#include <KDSoapServer.h>
Public Types | |
enum | Feature { Public = 0 , Ssl = 1 , AuthRequired = 2 } |
enum | LogLevel { LogNothing , LogFaults , LogEveryCall } |
Public Slots | |
void | resume () |
void | suspend () |
Signals | |
void | connectionRejected () |
Public Member Functions | |
KDSoapServer (QObject *parent=0) | |
~KDSoapServer () | |
void | closeLogFile () |
virtual QObject * | createServerObject ()=0 |
QString | endPoint () const |
Features | features () const |
void | flushLogFile () |
QString | logFileName () const |
LogLevel | logLevel () const |
int | maxConnections () const |
int | numConnectedSockets () const |
QString | path () const |
void | resetTotalConnectionCount () |
void | setFeatures (Features features) |
void | setLogFileName (const QString &fileName) |
void | setLogLevel (LogLevel level) |
void | setMaxConnections (int sockets) |
void | setPath (const QString &path) |
void | setSslConfiguration (const QSslConfiguration &config) |
void | setThreadPool (KDSoapThreadPool *threadPool) |
void | setUse (KDSoapMessage::Use use) |
void | setWsdlFile (const QString &file, const QString &pathInUrl) |
QSslConfiguration | sslConfiguration () const |
KDSoapThreadPool * | threadPool () const |
int | totalConnectionCount () const |
KDSoapMessage::Use | use () const |
QString | wsdlFile () const |
QString | wsdlPathInUrl () const |
Static Public Member Functions | |
static bool | setExpectedSocketCount (int sockets) |
Protected Member Functions | |
void | incomingConnection (qintptr socketDescriptor) override |
HTTP soap server.
Every instance of KDSoapServer represents one service, listening on one port. Call the listen() method from QTcpServer in order to start listening on a port.
KDSoapServer is a base class for your server, you must inherit from it and reimplement the method createServerObject().
Definition at line 29 of file KDSoapServer.h.
Enumerator | |
---|---|
Public | HTTP with no ssl and no authentication needed (default) |
Ssl | HTTPS. |
AuthRequired | Requires authentication. Currently not implemented, patches welcome. |
Definition at line 46 of file KDSoapServer.h.
Enumerator | |
---|---|
LogNothing | |
LogFaults | |
LogEveryCall |
Definition at line 124 of file KDSoapServer.h.
|
explicit |
Constructs a Soap Server.
By default it will not use threads to handle requests, see setThreadPool for that.
Definition at line 65 of file KDSoapServer.cpp.
KDSoapServer::~KDSoapServer | ( | ) |
Destructor. Deletes the server object factory as well.
Definition at line 73 of file KDSoapServer.cpp.
void KDSoapServer::closeLogFile | ( | ) |
Close the log file. This can be used to then rename it, in order to implement log file rotation.
Definition at line 215 of file KDSoapServer.cpp.
|
signal |
Emitted when the maximum number of connections has been reached, and a client connection was just rejected.
Referenced by incomingConnection().
|
pure virtual |
Reimplement this method to create an application-specific server object to handle incoming requests. Important: the created object must derive from KDSoapServerObjectInterface and must use Q_INTERFACES(KDSoapServerObjectInterface) under the Q_OBJECT macro.
When using a thread pool, this method will be called from different threads. The server takes ownership of the created object.
QString KDSoapServer::endPoint | ( | ) | const |
Returns the HTTP URL which can be used to access this server. For instance "http://127.0.0.1:8000/".
If the server is listening for connections yet, returns an empty string.
Definition at line 138 of file KDSoapServer.cpp.
References Ssl.
KDSoapServer::Features KDSoapServer::features | ( | ) | const |
Returns the features of the server that were enabled.
Definition at line 347 of file KDSoapServer.cpp.
Referenced by KDSoapSocketList::handleIncomingConnection(), and setFeatures().
void KDSoapServer::flushLogFile | ( | ) |
Force flushing the log file to disk.
Definition at line 208 of file KDSoapServer.cpp.
|
overrideprotected |
Definition at line 78 of file KDSoapServer.cpp.
References connectionRejected(), maxConnections(), and numConnectedSockets().
QString KDSoapServer::logFileName | ( | ) | const |
Returns the name of the log file given to setLogFileName().
Definition at line 181 of file KDSoapServer.cpp.
KDSoapServer::LogLevel KDSoapServer::logLevel | ( | ) | const |
Returns the level of logging set by setLogLevel.
Definition at line 169 of file KDSoapServer.cpp.
Referenced by KDSoapServerSocket::sendReply().
int KDSoapServer::maxConnections | ( | ) | const |
Returns the maximum of concurrent connections as set by setMaxConnections.
The special value -1 means unlimited.
Definition at line 335 of file KDSoapServer.cpp.
Referenced by incomingConnection().
int KDSoapServer::numConnectedSockets | ( | ) | const |
Returns the number of connected sockets at this precise moment. This information can change at any time, and is therefore only useful for statistical purposes.
It will always be less than maxConnections(), if maxConnections was set.
Definition at line 97 of file KDSoapServer.cpp.
Referenced by incomingConnection().
QString KDSoapServer::path | ( | ) | const |
Returns the path set by setPath()
Definition at line 323 of file KDSoapServer.cpp.
Referenced by setPath().
void KDSoapServer::resetTotalConnectionCount | ( | ) |
|
slot |
Resume activity after suspend
Definition at line 286 of file KDSoapServer.cpp.
|
static |
Sets the number of expected sockets (connections) in this process. This is necessary in order to increase system limits when a large number of clients is expected.
The special value -1 means "as many as possible in this non-root process". Only processes running as root can set the absolute maximum to an arbitrary value.
Definition at line 222 of file KDSoapServer.cpp.
void KDSoapServer::setFeatures | ( | Features | features | ) |
Set all the features of the server that should be enabled. For instance, the use of SSL, or the use of authentication.
Definition at line 341 of file KDSoapServer.cpp.
References features().
void KDSoapServer::setLogFileName | ( | const QString & | fileName | ) |
Sets the name of the file where logging should go. The server always appends to this file, you should delete it or rename it first if you don't want an ever-growing log file.
Definition at line 175 of file KDSoapServer.cpp.
void KDSoapServer::setLogLevel | ( | KDSoapServer::LogLevel | level | ) |
Sets the level of logging to be used by this SOAP server:
Warning: enabling logging reduces performance severely. Not only because of the time spent logging, but also because the threads can only write one at a time to the file, to avoid mixed output.
Definition at line 163 of file KDSoapServer.cpp.
void KDSoapServer::setMaxConnections | ( | int | sockets | ) |
Sets a maximum number of concurrent connections to this server. When this number is reached, connections are rejected, and the signal clientConnectionRejected is emitted for each rejected connection.
The special value -1 means unlimited.
Definition at line 329 of file KDSoapServer.cpp.
void KDSoapServer::setPath | ( | const QString & | path | ) |
Sets the path that the server expects in client requests. By default the path is '/', but this can be changed here.
The path is returned in endPoint(), and is checked when handling incoming requests.
Definition at line 317 of file KDSoapServer.cpp.
References path().
void KDSoapServer::setSslConfiguration | ( | const QSslConfiguration & | config | ) |
Sets the ssl configuration to use for new server connections
config | ssl configuration to use for new connections |
Definition at line 359 of file KDSoapServer.cpp.
void KDSoapServer::setThreadPool | ( | KDSoapThreadPool * | threadPool | ) |
Sets the thread pool for this server. This is useful if you want to share a thread pool between multiple server instances, in order to ensure an overall maximum of threads, across multiple services. An existing thread pool will be removed, but not deleted. KDSoapServer does not take ownership of the thread pool.
Definition at line 128 of file KDSoapServer.cpp.
References threadPool().
void KDSoapServer::setUse | ( | KDSoapMessage::Use | use | ) |
Define the way the message should be serialized: with or without type information. This value usually comes from the <binding> element in the WSDL service description. The default value is KDSoapMessage::LiteralUse.
Definition at line 153 of file KDSoapServer.cpp.
References use().
void KDSoapServer::setWsdlFile | ( | const QString & | file, |
const QString & | pathInUrl | ||
) |
Sets the .wsdl file that users can download from the soap server.
file | relative or absolute path to the .wsdl file (including the filename), on disk |
pathInUrl | that clients can use in order to download the file: for instance "/files/myservice.wsdl" for "https://myserver.example.com/files/myservice.wsdl" as final URL. |
Definition at line 298 of file KDSoapServer.cpp.
QSslConfiguration KDSoapServer::sslConfiguration | ( | ) | const |
Definition at line 354 of file KDSoapServer.cpp.
Referenced by KDSoapSocketList::handleIncomingConnection().
|
slot |
Temporarily suspend (do not listen to incoming connections, and close all connected sockets after servicing current requests).
Definition at line 272 of file KDSoapServer.cpp.
KDSoapThreadPool * KDSoapServer::threadPool | ( | ) | const |
Returns the thread pool for this server, or 0 if no thread pool was set.
Definition at line 133 of file KDSoapServer.cpp.
Referenced by setThreadPool().
int KDSoapServer::totalConnectionCount | ( | ) | const |
Returns the number of sockets that have connected to the server since the last call to resetTotalConnectionCount().
Definition at line 108 of file KDSoapServer.cpp.
KDSoapMessage::Use KDSoapServer::use | ( | ) | const |
Returns the value passed to setUse().
Definition at line 158 of file KDSoapServer.cpp.
Referenced by setUse().
QString KDSoapServer::wsdlFile | ( | ) | const |
Definition at line 305 of file KDSoapServer.cpp.
QString KDSoapServer::wsdlPathInUrl | ( | ) | const |
Definition at line 311 of file KDSoapServer.cpp.