KD SOAP  1.10.0
KDSoapServerObjectInterface.h
1 /****************************************************************************
2 **
3 ** This file is part of the KD Soap library.
4 **
5 ** SPDX-FileCopyrightText: 2010-2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6 **
7 ** SPDX-License-Identifier: LicenseRef-KDAB-KDSoap-AGPL3-Modified OR LicenseRef-KDAB-KDSoap OR LicenseRef-KDAB-KDSoap-US
8 **
9 ** Licensees holding valid commercial KD Soap licenses may use this file in
10 ** accordance with the KD Soap Commercial License Agreement provided with
11 ** the Software.
12 **
13 ** Contact info@kdab.com if any conditions of this licensing are not clear to you.
14 **
15 ****************************************************************************/
16 #ifndef KDSOAPSERVEROBJECTINTERFACE_H
17 #define KDSOAPSERVEROBJECTINTERFACE_H
18 
19 #include "KDSoapServerGlobal.h"
20 #include <KDSoapClient/KDSoapMessage.h>
21 #include "KDSoapDelayedResponseHandle.h"
22 
23 #include <QtCore/QObject>
24 #include <QtCore/QByteArray>
25 #include <QtCore/QVector>
26 #include <QIODevice>
27 
28 class KDSoapServerSocket;
29 
30 QT_BEGIN_NAMESPACE
31 class QAbstractSocket;
32 QT_END_NAMESPACE
33 
65 class KDSOAPSERVER_EXPORT KDSoapServerObjectInterface
66 {
67 public:
75  virtual ~KDSoapServerObjectInterface();
76 
90  virtual void processRequest(const KDSoapMessage &request, KDSoapMessage &response, const QByteArray &soapAction);
91 
104  virtual QIODevice *processFileRequest(const QString &path, QByteArray &contentType);
105 
124  virtual void processRequestWithPath(const KDSoapMessage &request, KDSoapMessage &response, const QByteArray &soapAction, const QString &path);
125 
126  struct KDSOAPSERVER_EXPORT HttpResponseHeaderItem {
127  HttpResponseHeaderItem();
128  HttpResponseHeaderItem(const QByteArray &name, const QByteArray &value);
129  QByteArray m_value;
130  QByteArray m_name;
131  };
132 
133  typedef QVector<HttpResponseHeaderItem> HttpResponseHeaderItems;
134 
141  virtual HttpResponseHeaderItems additionalHttpResponseHeaderItems() const;
142 
149  void doneProcessingRequestWithPath(const KDSoapServerObjectInterface &otherInterface);
150 
156  KDSoapHeaders requestHeaders() const;
157 
161  QByteArray soapAction() const;
162 
166  void setResponseHeaders(const KDSoapHeaders &headers);
167 
175  void setResponseNamespace(const QString &ns);
176 
188  void setFault(const QString &faultCode, const QString &faultString, const QString &faultActor = QString(), const QString &detail = QString());
189 
201  void setFault(const QString &faultCode, const QString &faultString, const QString &faultActor, const KDSoapValue &detail);
202 
206  bool hasFault() const;
207 
213  QAbstractSocket *serverSocket() const;
214 
223  KDSoapDelayedResponseHandle prepareDelayedResponse(); // only valid during processRequest()
229  bool isDelayedResponse() const; // only valid during processRequest()
230 
237  void sendDelayedResponse(const KDSoapDelayedResponseHandle &responseHandle, const KDSoapMessage &response);
238 
245  void writeHTTP(const QByteArray &httpReply);
246 
255  void writeXML(const QByteArray &reply, bool isFault = false);
256 
257 private:
258  friend class KDSoapServerSocket;
259  void setServerSocket(KDSoapServerSocket *serverSocket); // only valid during processRequest()
260  void setRequestHeaders(const KDSoapHeaders &headers, const QByteArray &soapAction);
261  KDSoapHeaders responseHeaders() const;
262  QString responseNamespace() const;
263  void storeFaultAttributes(KDSoapMessage &message) const;
264  class Private;
265  Private *const d;
266 };
267 
268 QT_BEGIN_NAMESPACE
269 Q_DECLARE_INTERFACE(KDSoapServerObjectInterface,
270  "com.kdab.KDSoap.ServerObjectInterface/1.0")
271 QT_END_NAMESPACE
272 
273 #endif // KDSOAPSERVEROBJECTINTERFACE_H
Definition: KDSoapValue.h:69
Definition: KDSoapMessage.h:188
Definition: KDSoapServerObjectInterface.h:65
Definition: KDSoapMessage.h:34
Definition: KDSoapDelayedResponseHandle.h:32

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/