KD SOAP API Documentation: KDSoapServer Class Reference

| KD SOAP API Documentation 2.2

Loading...
Searching...
No Matches
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
KDSoapServer Class Referenceabstract

`#include <KDSoapServer.h>`

Inheritance diagram for KDSoapServer:
[legend]
Collaboration diagram for KDSoapServer:
[legend]

## 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
Public Member Functions inherited from QTcpServer
| QTcpServer (QObject *parent)
virtual | ~QTcpServer ()
void | acceptError (QAbstractSocket::SocketError socketError)
void | close ()
QString | errorString () const const
virtual bool | hasPendingConnections () const const
bool | isListening () const const
bool | listen (const QHostAddress &address, quint16 port)
int | maxPendingConnections () const const
void | newConnection ()
virtual QTcpSocket * | nextPendingConnection ()
void | pauseAccepting ()
QNetworkProxy | proxy () const const
void | resumeAccepting ()
QHostAddress | serverAddress () const const
QAbstractSocket::SocketError | serverError () const const
quint16 | serverPort () const const
void | setMaxPendingConnections (int numConnections)
void | setProxy (const QNetworkProxy &networkProxy)
bool | setSocketDescriptor (qintptr socketDescriptor)
qintptr | socketDescriptor () const const
bool | waitForNewConnection (int msec, bool *timedOut)
Public Member Functions inherited from QObject
| QObject (QObject *parent)
virtual | ~QObject ()
bool | blockSignals (bool block)
const QObjectList & | children () const const
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
void | deleteLater ()
void | destroyed (QObject *obj)
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const
bool | disconnect (const QObject *receiver, const char *method) const const
void | dumpObjectInfo ()
void | dumpObjectInfo () const const
void | dumpObjectTree ()
void | dumpObjectTree () const const
QList< QByteArray > | dynamicPropertyNames () const const
virtual bool | event (QEvent *e)
virtual bool | eventFilter (QObject *watched, QEvent *event)
T | findChild (const QString &name, Qt::FindChildOptions options) const const
QList< T > | findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const
bool | inherits (const char *className) const const
void | installEventFilter (QObject *filterObj)
bool | isWidgetType () const const
bool | isWindowType () const const
void | killTimer (int id)
virtual const QMetaObject * | metaObject () const const
void | moveToThread (QThread *targetThread)
QString | objectName () const const
void | objectNameChanged (const QString &objectName)
QObject * | parent () const const
QVariant | property (const char *name) const const
| Q_CLASSINFO (Name, Value)
| Q_DISABLE_COPY (Class)
| Q_DISABLE_COPY_MOVE (Class)
| Q_DISABLE_MOVE (Class)
| Q_EMIT Q_EMIT
| Q_ENUM (...)
| Q_ENUM_NS (...)
| Q_ENUMS (...)
| Q_FLAG (...)
| Q_FLAG_NS (...)
| Q_FLAGS (...)
| Q_GADGET Q_GADGET
| Q_INTERFACES (...)
| Q_INVOKABLE Q_INVOKABLE
| Q_NAMESPACE Q_NAMESPACE
| Q_NAMESPACE_EXPORT (EXPORT_MACRO)
| Q_OBJECT Q_OBJECT
| Q_PROPERTY (...)
| Q_REVISION Q_REVISION
| Q_SET_OBJECT_NAME (Object)
| Q_SIGNAL Q_SIGNAL
| Q_SIGNALS Q_SIGNALS
| Q_SLOT Q_SLOT
| Q_SLOTS Q_SLOTS
T | qFindChild (const QObject *obj, const QString &name)
QList< T > | qFindChildren (const QObject *obj, const QRegExp &regExp)
QList< T > | qFindChildren (const QObject *obj, const QString &name)
T | qobject_cast (const QObject *object)
T | qobject_cast (QObject *object)
| QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
void | removeEventFilter (QObject *obj)
void | setObjectName (const QString &name)
void | setParent (QObject *parent)
bool | setProperty (const char *name, const QVariant &value)
bool | signalsBlocked () const const
int | startTimer (int interval, Qt::TimerType timerType)
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
QThread * | thread () const const

## Static Public Member Functions
static bool | setExpectedSocketCount (int sockets)
Static Public Member Functions inherited from QObject
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool | disconnect (const QMetaObject::Connection &connection)
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
QString | tr (const char *sourceText, const char *disambiguation, int n)
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n)

## Protected Member Functions
void | incomingConnection (qintptr socketDescriptor) override
Protected Member Functions inherited from QTcpServer
void | addPendingConnection (QTcpSocket *socket)
Protected Member Functions inherited from QObject
virtual void | childEvent (QChildEvent *event)
virtual void | connectNotify (const QMetaMethod &signal)
virtual void | customEvent (QEvent *event)
virtual void | disconnectNotify (const QMetaMethod &signal)
bool | isSignalConnected (const QMetaMethod &signal) const const
int | receivers (const char *signal) const const
QObject * | sender () const const
int | senderSignalIndex () const const
virtual void | timerEvent (QTimerEvent *event)

## Additional Inherited Members
Public Attributes inherited from QObject
typedef | QObjectList
Properties inherited from QObject
| objectName

## Detailed Description

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.

## Member Enumeration Documentation

## ◆ Feature

enum KDSoapServer::Feature

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.

## ◆ LogLevel

enum KDSoapServer::LogLevel

Enumerator
LogNothing |
LogFaults |
LogEveryCall |

Definition at line 124 of file KDSoapServer.h.

## Constructor & Destructor Documentation

## ◆ KDSoapServer()

KDSoapServer::KDSoapServer | ( | QObject * | parent = `0` | ) |
| 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.

References QTcpServer::setMaxPendingConnections().

## ◆ ~KDSoapServer()

KDSoapServer::~KDSoapServer | ( |  | ) |

Destructor. Deletes the server object factory as well.

Definition at line 73 of file KDSoapServer.cpp.

## Member Function Documentation

## ◆ closeLogFile()

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 214 of file KDSoapServer.cpp.

## ◆ connectionRejected

void KDSoapServer::connectionRejected | ( |  | ) |
| signal

Emitted when the maximum number of connections has been reached, and a client connection was just rejected.

Referenced by incomingConnection().

## ◆ createServerObject()

virtual QObject * KDSoapServer::createServerObject | ( |  | ) |
| 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.

## ◆ endPoint()

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 QHostAddress::Any, QString::arg(), QString::fromLatin1(), QHostAddress::Null, QObject::qobject_cast(), QTcpServer::serverAddress(), QTcpServer::serverPort(), Ssl, and QHostAddress::toString().

## ◆ features()

KDSoapServer::Features KDSoapServer::features | ( |  | ) | const

Returns the features of the server that were enabled.

Definition at line 346 of file KDSoapServer.cpp.

Referenced by KDSoapSocketList::handleIncomingConnection(), and setFeatures().

## ◆ flushLogFile()

void KDSoapServer::flushLogFile | ( |  | ) |

Force flushing the log file to disk.

Definition at line 207 of file KDSoapServer.cpp.

## ◆ incomingConnection()

void KDSoapServer::incomingConnection | ( | qintptr | socketDescriptor | ) |
| overrideprotectedvirtual

Reimplemented from QTcpServer.

Definition at line 78 of file KDSoapServer.cpp.

References connectionRejected(), maxConnections(), QByteArray::number(), numConnectedSockets(), QObject::qobject_cast(), and QTcpServer::socketDescriptor().

## ◆ logFileName()

QString KDSoapServer::logFileName | ( |  | ) | const

Returns the name of the log file given to setLogFileName().

Definition at line 180 of file KDSoapServer.cpp.

## ◆ logLevel()

KDSoapServer::LogLevel KDSoapServer::logLevel | ( |  | ) | const

Returns the level of logging set by setLogLevel.

Definition at line 168 of file KDSoapServer.cpp.

Referenced by KDSoapServerSocket::sendReply().

## ◆ maxConnections()

int KDSoapServer::maxConnections | ( |  | ) | const

Returns the maximum of concurrent connections as set by setMaxConnections.

The special value -1 means unlimited.

Definition at line 334 of file KDSoapServer.cpp.

Referenced by incomingConnection().

## ◆ numConnectedSockets()

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().

## ◆ path()

QString KDSoapServer::path | ( |  | ) | const

Returns the path set by setPath()

Definition at line 322 of file KDSoapServer.cpp.

Referenced by setPath().

## ◆ resetTotalConnectionCount()

void KDSoapServer::resetTotalConnectionCount | ( |  | ) |

Resets totalConnectionCount to 0.

Since
  1.2

Definition at line 119 of file KDSoapServer.cpp.

## ◆ resume

void KDSoapServer::resume | ( |  | ) |
| slot

Resume activity after suspend

Definition at line 285 of file KDSoapServer.cpp.

References QTcpServer::listen(), and QObject::qobject_cast().

## ◆ setExpectedSocketCount()

bool KDSoapServer::setExpectedSocketCount | ( | int | sockets | ) |
| 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 221 of file KDSoapServer.cpp.

References QObject::qobject_cast().

## ◆ setFeatures()

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 340 of file KDSoapServer.cpp.

References features().

## ◆ setLogFileName()

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 174 of file KDSoapServer.cpp.

## ◆ setLogLevel()

void KDSoapServer::setLogLevel | ( | KDSoapServer::LogLevel | level | ) |

Sets the level of logging to be used by this SOAP server:

- LogNothing: no logging (the default).
- LogFaults: log all faults.
- LogEveryCall: log every call, successful or not.

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 162 of file KDSoapServer.cpp.

References QObject::qobject_cast().

## ◆ setMaxConnections()

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 328 of file KDSoapServer.cpp.

References QObject::qobject_cast().

## ◆ setPath()

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 316 of file KDSoapServer.cpp.

References path().

## ◆ setSslConfiguration()

void KDSoapServer::setSslConfiguration | ( | const QSslConfiguration & | config | ) |

Sets the ssl configuration to use for new server connections

Parameters

  config | ssl configuration to use for new connections

Definition at line 358 of file KDSoapServer.cpp.

References QObject::qobject_cast().

## ◆ setThreadPool()

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().

## ◆ setUse()

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.

See also
  KDSoapMessage::Use

Definition at line 152 of file KDSoapServer.cpp.

References use().

## ◆ setWsdlFile()

void KDSoapServer::setWsdlFile | ( | const QString & | file,
|  | const QString & | pathInUrl
| ) |  |

Sets the .wsdl file that users can download from the soap server.

Parameters

  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 297 of file KDSoapServer.cpp.

References QObject::qobject_cast().

## ◆ sslConfiguration()

QSslConfiguration KDSoapServer::sslConfiguration | ( |  | ) | const

Returns
  the ssl configuration for this server

Definition at line 353 of file KDSoapServer.cpp.

Referenced by KDSoapSocketList::handleIncomingConnection().

## ◆ suspend

void KDSoapServer::suspend | ( |  | ) |
| slot

Temporarily suspend (do not listen to incoming connections, and close all connected sockets after servicing current requests).

Definition at line 271 of file KDSoapServer.cpp.

References QTcpServer::close(), QTcpServer::serverAddress(), and QTcpServer::serverPort().

## ◆ threadPool()

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().

## ◆ totalConnectionCount()

int KDSoapServer::totalConnectionCount | ( |  | ) | const

Returns the number of sockets that have connected to the server since the last call to resetTotalConnectionCount().

Since
  1.2

Definition at line 108 of file KDSoapServer.cpp.

## ◆ use()

KDSoapMessage::Use KDSoapServer::use | ( |  | ) | const

Returns the value passed to setUse().

Definition at line 157 of file KDSoapServer.cpp.

Referenced by setUse().

## ◆ wsdlFile()

QString KDSoapServer::wsdlFile | ( |  | ) | const

Returns
  the path to the wsdl file on disk, as given to setWsdlFile

Definition at line 304 of file KDSoapServer.cpp.

## ◆ wsdlPathInUrl()

QString KDSoapServer::wsdlPathInUrl | ( |  | ) | const

Returns
  the path given to setWsdlFile

Definition at line 310 of file KDSoapServer.cpp.

The documentation for this class was generated from the following files:

- KDSoapServer.h
- KDSoapServer.cpp

© 2010-2024 Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-soap/
Generated on Sun Jan 7 2024 11:47:36 for KD SOAP API Documentation by doxygen 1.9.8