KD SOAP: KDSoapServer Class Reference

| KD SOAP 2.0.0

Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | List of all members
KDSoapServer Class Referenceabstract

`#include <KDSoapServer.h>`

Inherits QTcpServer.

## Public Types
enum | Feature { Public = 0, Ssl = 1, AuthRequired = 2 }

## Public Slots
void | suspend ()
void | resume ()

## Signals
void | connectionRejected ()

## Public Member Functions
| KDSoapServer (QObject *parent=0)
| ~KDSoapServer ()
void | setFeatures (Features features)
Features | features () const
void | setThreadPool (KDSoapThreadPool *threadPool)
KDSoapThreadPool * | threadPool () const
void | setPath (const QString &path)
QString | path () const
QString | endPoint () const
virtual QObject * | createServerObject ()=0
void | setUse (KDSoapMessage::Use use)
KDSoapMessage::Use | use () const
void | setLogLevel (LogLevel level)
LogLevel | logLevel () const
void | setLogFileName (const QString &fileName)
QString | logFileName () const
void | flushLogFile ()
void | closeLogFile ()
void | setMaxConnections (int sockets)
int | maxConnections () const
int | numConnectedSockets () const
int | totalConnectionCount () const
void | resetTotalConnectionCount ()
void | setWsdlFile (const QString &file, const QString &pathInUrl)
QString | wsdlFile () const
QString | wsdlPathInUrl () const
QSslConfiguration | sslConfiguration () const
void | setSslConfiguration (const QSslConfiguration &config)

## Static Public Member Functions
static bool | setExpectedSocketCount (int sockets)

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

## 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.

## 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.

## ◆ ~KDSoapServer()

KDSoapServer::~KDSoapServer | ( |  | ) |

Destructor. Deletes the server object factory as well.

## Member Function Documentation

## ◆ 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.

## ◆ features()

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

Returns the features of the server that were enabled.

## ◆ 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.

## ◆ threadPool()

KDSoapThreadPool * KDSoapServer::threadPool | ( |  | ) | const

Returns the thread pool for this server, or 0 if no thread pool was set.

## ◆ 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.

## ◆ path()

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

Returns the path set by setPath()

## ◆ 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.

## ◆ 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.

## ◆ 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

## ◆ use()

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

Returns the value passed to setUse().

## ◆ 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.

## ◆ logLevel()

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

Returns the level of logging set by setLogLevel.

## ◆ 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.

## ◆ logFileName()

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

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

## ◆ flushLogFile()

void KDSoapServer::flushLogFile | ( |  | ) |

Force flushing the log file to disk.

## ◆ closeLogFile()

void KDSoapServer::closeLogFile | ( |  | ) |

Close the log file. This can be used to then rename it, in order to implement log file rotation.

## ◆ 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.

## ◆ maxConnections()

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

Returns the maximum of concurrent connections as set by setMaxConnections.

The special value -1 means unlimited.

## ◆ 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.

## ◆ 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.

## ◆ 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

## ◆ resetTotalConnectionCount()

void KDSoapServer::resetTotalConnectionCount | ( |  | ) |

Resets totalConnectionCount to 0.

Since
  1.2

## ◆ 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.

## ◆ wsdlFile()

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

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

## ◆ wsdlPathInUrl()

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

Returns
  the path given to setWsdlFile

## ◆ sslConfiguration()

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

Returns
  the ssl configuration for this server

## ◆ 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

## ◆ suspend

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

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

## ◆ resume

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

Resume activity after suspend

## ◆ connectionRejected

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

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

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

- /home/allen/projects/kdsoap/src/KDSoapServer/KDSoapServer.h
- /home/allen/projects/kdsoap/src/KDSoapServer/KDSoapServer.cpp

© 2010-2021 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 Wed Jun 30 2021 18:19:27 for KD SOAP by doxygen 1.8.20