KD SOAP  1.8.0
KDSoapServerObjectInterface.h
1 /****************************************************************************
2 ** Copyright (C) 2010-2019 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com.
3 ** All rights reserved.
4 **
5 ** This file is part of the KD Soap library.
6 **
7 ** Licensees holding valid commercial KD Soap licenses may use this file in
8 ** accordance with the KD Soap Commercial License Agreement provided with
9 ** the Software.
10 **
11 **
12 ** This file may be distributed and/or modified under the terms of the
13 ** GNU Lesser General Public License version 2.1 and version 3 as published by the
14 ** Free Software Foundation and appearing in the file LICENSE.LGPL.txt included.
15 **
16 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
17 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18 **
19 ** Contact info@kdab.com if any conditions of this licensing are not
20 ** clear to you.
21 **
22 **********************************************************************/
23 #ifndef KDSOAPSERVEROBJECTINTERFACE_H
24 #define KDSOAPSERVEROBJECTINTERFACE_H
25 
26 #include "KDSoapServerGlobal.h"
27 #include <KDSoapClient/KDSoapMessage.h>
28 #include "KDSoapDelayedResponseHandle.h"
29 
30 #include <QtCore/QObject>
31 #include <QtCore/QByteArray>
32 #include <QtCore/QVector>
33 #include <QIODevice>
34 
35 class KDSoapServerSocket;
36 
37 QT_BEGIN_NAMESPACE
38 class QAbstractSocket;
39 QT_END_NAMESPACE
40 
72 class KDSOAPSERVER_EXPORT KDSoapServerObjectInterface
73 {
74 public:
82  virtual ~KDSoapServerObjectInterface();
83 
97  virtual void processRequest(const KDSoapMessage &request, KDSoapMessage &response, const QByteArray &soapAction);
98 
111  virtual QIODevice *processFileRequest(const QString &path, QByteArray &contentType);
112 
131  virtual void processRequestWithPath(const KDSoapMessage &request, KDSoapMessage &response, const QByteArray &soapAction, const QString &path);
132 
133  struct KDSOAPSERVER_EXPORT HttpResponseHeaderItem {
134  HttpResponseHeaderItem();
135  HttpResponseHeaderItem(const QByteArray &name, const QByteArray &value);
136  QByteArray m_value;
137  QByteArray m_name;
138  };
139 
140  typedef QVector<HttpResponseHeaderItem> HttpResponseHeaderItems;
141 
148  virtual HttpResponseHeaderItems additionalHttpResponseHeaderItems() const;
149 
156  void doneProcessingRequestWithPath(const KDSoapServerObjectInterface &otherInterface);
157 
163  KDSoapHeaders requestHeaders() const;
164 
168  QByteArray soapAction() const;
169 
173  void setResponseHeaders(const KDSoapHeaders &headers);
174 
182  void setResponseNamespace(const QString &ns);
183 
195  void setFault(const QString &faultCode, const QString &faultString, const QString &faultActor = QString(), const QString &detail = QString());
196 
208  void setFault(const QString &faultCode, const QString &faultString, const QString &faultActor, const KDSoapValue &detail);
209 
213  bool hasFault() const;
214 
220  QAbstractSocket *serverSocket() const;
221 
230  KDSoapDelayedResponseHandle prepareDelayedResponse(); // only valid during processRequest()
236  bool isDelayedResponse() const; // only valid during processRequest()
237 
244  void sendDelayedResponse(const KDSoapDelayedResponseHandle &responseHandle, const KDSoapMessage &response);
245 
252  void writeHTTP(const QByteArray &httpReply);
253 
262  void writeXML(const QByteArray &reply, bool isFault = false);
263 
264 private:
265  friend class KDSoapServerSocket;
266  void setServerSocket(KDSoapServerSocket *serverSocket); // only valid during processRequest()
267  void setRequestHeaders(const KDSoapHeaders &headers, const QByteArray &soapAction);
268  KDSoapHeaders responseHeaders() const;
269  QString responseNamespace() const;
270  void storeFaultAttributes(KDSoapMessage &message) const;
271  class Private;
272  Private *const d;
273 };
274 
275 QT_BEGIN_NAMESPACE
276 Q_DECLARE_INTERFACE(KDSoapServerObjectInterface,
277  "com.kdab.KDSoap.ServerObjectInterface/1.0")
278 QT_END_NAMESPACE
279 
280 #endif // KDSOAPSERVEROBJECTINTERFACE_H
Definition: KDSoapValue.h:76
Definition: KDSoapMessage.h:195
Definition: KDSoapServerObjectInterface.h:72
Definition: KDSoapMessage.h:41
Definition: KDSoapDelayedResponseHandle.h:39

Klarälvdalens Datakonsult AB (KDAB)
Qt-related services and products
http://www.kdab.com/
http://www.kdab.com/products/kd-soap/