19 #include <QAuthenticator>
22 #include <QNetworkProxy>
23 #include <QNetworkReply>
24 #include <QNetworkRequest>
25 #include <QSslConfiguration>
54 : m_accessManager(nullptr)
75 connect(
m_accessManager, &QNetworkAccessManager::authenticationRequired,
this, &KDSoapClientInterfacePrivate::_kd_slotAuthenticationRequired);
82 QNetworkRequest request(QUrl(this->
m_endPoint));
84 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
86 request.setAttribute(QNetworkRequest::Http2AllowedAttribute,
false);
89 QString soapAction = action;
91 if (soapAction.isNull()) {
96 if (!soapAction.endsWith(QLatin1Char(
'/'))) {
97 soapAction += QLatin1Char(
'/');
105 soapHeader += QString::fromLatin1(
"text/xml;charset=utf-8");
106 request.setRawHeader(
"SoapAction",
'\"' + soapAction.toUtf8() +
'\"');
108 soapHeader += QString::fromLatin1(
"application/soap+xml;charset=utf-8");
110 soapHeader += QString::fromLatin1(
";action=") + soapAction;
113 request.setHeader(QNetworkRequest::ContentTypeHeader, soapHeader.toUtf8());
121 request.setRawHeader(
"Accept-Encoding",
"compress");
124 request.setRawHeader(it.key(), it.value());
141 QBuffer *buffer =
new QBuffer;
156 if (!prop.
action().isEmpty())
157 qWarning(
"Overwriting the action addressing parameter (%s) with the SOAP action (%s)",
158 prop.
action().toLocal8Bit().constData(), soapAction.toLocal8Bit().constData());
162 setBufferData(messageCopy);
164 setBufferData(message);
166 buffer->open(QIODevice::ReadOnly);
175 QNetworkReply *reply = d->
accessManager()->post(request, buffer);
208 QNetworkReply *reply = d->
accessManager()->post(request, buffer);
211 QObject::connect(reply, &QNetworkReply::finished, reply, &QNetworkReply::deleteLater);
212 QObject::connect(reply, &QNetworkReply::finished, buffer, &QBuffer::deleteLater);
215 void KDSoapClientInterfacePrivate::_kd_slotAuthenticationRequired(QNetworkReply *reply, QAuthenticator *authenticator)
260 class TimeoutHandler :
public QTimer
264 TimeoutHandler(QNetworkReply *reply)
272 QNetworkReply *reply = qobject_cast<QNetworkReply *>(parent());
276 reply->setProperty(
"kdsoap_reply_timed_out",
true);
285 QObject::connect(reply, &QNetworkReply::sslErrors, reply, QOverload<>::of(&QNetworkReply::ignoreSslErrors));
297 TimeoutHandler *timeoutHandler =
new TimeoutHandler(reply);
298 connect(timeoutHandler, &TimeoutHandler::timeout, timeoutHandler, &TimeoutHandler::replyTimeout);
325 QObject *oldParent = jar->parent();
327 jar->setParent(oldParent);
381 #ifndef QT_NO_OPENSSL
401 #include "KDSoapClientInterface.moc"
402 #include "moc_KDSoapClientInterface_p.cpp"
void maybeDebugRequest(const QByteArray &data, const QNetworkRequest &request, QNetworkReply *reply)
KDSoap::SoapVersion m_version
QNetworkAccessManager * m_accessManager
KDSoapClientInterface::Style m_style
KDSoapSslHandler * m_sslHandler
QMap< QString, KDSoapMessage > m_persistentHeaders
KDSoapClientInterfacePrivate()
void setupReply(QNetworkReply *reply)
QNetworkRequest prepareRequest(const QString &method, const QString &action)
KDSoapHeaders m_lastResponseHeaders
QNetworkAccessManager * accessManager()
QSslConfiguration m_sslConfiguration
KDSoapAuthentication m_authentication
bool m_hasMessageAddressingProperties
QMap< QByteArray, QByteArray > m_httpHeaders
KDSoapMessageAddressingProperties m_messageAddressingProperties
QString m_messageNamespace
QBuffer * prepareRequestBuffer(const QString &method, const KDSoapMessage &message, const QString &soapAction, const KDSoapHeaders &headers)
~KDSoapClientInterfacePrivate()
bool m_sendSoapActionInHttpHeader
bool m_sendSoapActionInWsAddressingHeader
QList< QSslError > m_ignoreErrorsList
KDSoapClientThread m_thread
void setMessageAddressingProperties(const KDSoapMessageAddressingProperties &map)
void setSoapVersion(KDSoapClientInterface::SoapVersion version)
void callNoReply(const QString &method, const KDSoapMessage &message, const QString &soapAction=QString(), const KDSoapHeaders &headers=KDSoapHeaders())
void setProxy(const QNetworkProxy &proxy)
QSslConfiguration sslConfiguration() const
KDSoapPendingCall asyncCall(const QString &method, const KDSoapMessage &message, const QString &soapAction=QString(), const KDSoapHeaders &headers=KDSoapHeaders())
KDSoapSslHandler * sslHandler() const
void setRawHTTPHeaders(const QMap< QByteArray, QByteArray > &headers)
QNetworkProxy proxy() const
bool sendSoapActionInHttpHeader() const
sendActionInHTTP_Header
bool sendSoapActionInWsAddressingHeader() const
sendSoapActionInWsAddressingHeader
void setCookieJar(QNetworkCookieJar *jar)
QNetworkCookieJar * cookieJar() const
KDSoapClientInterface(const QString &endPoint, const QString &messageNamespace)
void setSslConfiguration(const QSslConfiguration &config)
KDSoapHeaders lastResponseHeaders() const
@ RPCStyle
the method name is sent as an xml element wrapping the message parameters
void setEndPoint(const QString &endPoint)
void setStyle(Style style)
KDSoapMessage call(const QString &method, const KDSoapMessage &message, const QString &soapAction=QString(), const KDSoapHeaders &headers=KDSoapHeaders())
void setSendSoapActionInHttpHeader(bool sendInHttpHeader)
setSendSoapActionInHttpHeader
void setSendSoapActionInWsAddressingHeader(bool sendInWsAddressingHeader)
setSendSoapActionInWsAddressingHeader
void setAuthentication(const KDSoapAuthentication &authentication)
void setHeader(const QString &name, const KDSoapMessage &header)
KDSoapClientInterface::SoapVersion soapVersion() const
void setTimeout(int msecs)
void enqueue(KDSoapThreadTaskData *taskData)
void setAction(const QString &action)
QByteArray messageToXml(const KDSoapMessage &message, const QString &method, const KDSoapHeaders &headers, const QMap< QString, KDSoapMessage > &persistentHeaders, const KDSoapAuthentication &authentication=KDSoapAuthentication()) const
void setMessageNamespace(const QString &ns)
void setVersion(KDSoap::SoapVersion version)
void setMessageAddressingProperties(const KDSoapMessageAddressingProperties &map)
KDSoapMessageAddressingProperties messageAddressingProperties() const
A class for handling SSL errors during SOAP calls.
KDSoapAuthentication m_authentication
KDSoapMessage response() const
KDSoapHeaders responseHeaders() const