KD SOAP API Documentation 2.2
|
#include <KDSoapClientInterface.h>
Public Types | |
enum | SoapVersion { SOAP1_1 = 1 , SOAP1_2 = 2 } |
enum | Style { RPCStyle , DocumentStyle } |
KDSoapClientInterface is a generic accessor class that is used to place calls to remote SOAP objects. This class is useful for dynamic access to remote objects: that is, when you do not have a generated code that represents the remote interface.
Definition at line 50 of file KDSoapClientInterface.h.
Version of the SOAP protocol to use when sending requests.
Enumerator | |
---|---|
SOAP1_1 | Use format version 1.1 of the SOAP specification |
SOAP1_2 | Use format version 1.2 of the SOAP specification |
Definition at line 57 of file KDSoapClientInterface.h.
WSDL style. See the "style" attribute for soap:binding, in the WSDL file. See https://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/ for a discussion on the pros and cons of both styles.
In RPC style, the method name passed to call() or asyncCall() is sent as an xml element wrapping the message parameters.
In Document style, the KDSoapMessage represents the entire "document" to be sent, so the the method name passed to call() or asyncCall() is ignored, and the name of the KDSoapMessage is used as the main xml element name. This difference is mostly useful in the case of generated code, so that it can serialize existing complex types, and send them as messages.
Enumerator | |
---|---|
RPCStyle | the method name is sent as an xml element wrapping the message parameters |
DocumentStyle | the message is sent as is, the method name is usually the name of the message |
Definition at line 254 of file KDSoapClientInterface.h.
|
explicit |
Creates a KDSoapClientInterface object associated with the end point endPoint
.
endPoint | the URL of the SOAP service, including http or https scheme, port number if needed, and path. Example: http://server/path/soap.php |
messageNamespace | the namespace URI used for the message and its arguments. Example: http://server/path, but could be any URI, it doesn't have to exist or even to be http, this is really just a namespace, which is part of the specification of the SOAP service. |
Definition at line 28 of file KDSoapClientInterface.cpp.
References endPoint(), KDSoapClientInterfacePrivate::m_endPoint, KDSoapClientInterfacePrivate::m_messageNamespace, KDSoapClientInterfacePrivate::m_version, and KDSoap::SOAP1_1.
KDSoapClientInterface::~KDSoapClientInterface | ( | ) |
Destroys the object interface and frees up any resource used.
Definition at line 36 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_thread, KDSoapClientThread::stop(), and QThread::wait().
|
delete |
KDSoapPendingCall KDSoapClientInterface::asyncCall | ( | const QString & | method, |
const KDSoapMessage & | message, | ||
const QString & | soapAction = QString() , |
||
const KDSoapHeaders & | headers = KDSoapHeaders() |
||
) |
Calls the method method
on this interface and passes the arguments specified in message
to the method.
method | the method name, without arguments. For instance "addContact" . Only used in RPC style. |
message | arguments for the method call |
soapAction | optional "SoapAction" header, see the specification of the SOAP service. You are strongly encouraged to pass a value here, even if it's just "", given that by default (for a null string) KDSoap will generate a SOAPAction for backwards compatibility reasons. |
headers | optional arguments which will be passed as <soap:Header> . |
This is an asynchronous call, so this function returns immediately. The returned KDSoapPendingCall object can be used to find out information about the reply. You should create a KDSoapPendingCallWatcher to connect to the finished() signal.
Definition at line 170 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::accessManager(), call(), QBuffer::data(), KDSoapClientInterfacePrivate::m_version, maybeDebugRequest(), QNetworkAccessManager::post(), KDSoapClientInterfacePrivate::prepareRequest(), KDSoapClientInterfacePrivate::prepareRequestBuffer(), QNetworkReply::request(), and KDSoapClientInterfacePrivate::setupReply().
KDSoapMessage KDSoapClientInterface::call | ( | const QString & | method, |
const KDSoapMessage & | message, | ||
const QString & | soapAction = QString() , |
||
const KDSoapHeaders & | headers = KDSoapHeaders() |
||
) |
Calls the method method
on this interface and passes the parameters specified in message
to the method.
method | the method name, without arguments. For instance "addContact" . Only used in RPC style. |
message | arguments for the method call |
soapAction | optional "SoapAction" header, see the specification of the SOAP service. You are strongly encouraged to pass a value here, even if it's just "", given that by default (for a null string) KDSoap will generate a SOAPAction for backwards compatibility reasons. |
headers | optional arguments which will be passed as <soap:Header> . |
Definition at line 183 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::accessManager(), QNetworkAccessManager::cookieJar(), KDSoapClientThread::enqueue(), QThread::isRunning(), KDSoapClientInterfacePrivate::m_authentication, KDSoapThreadTaskData::m_authentication, KDSoapClientInterfacePrivate::m_lastResponseHeaders, KDSoapClientInterfacePrivate::m_thread, KDSoapThreadTaskData::response(), KDSoapThreadTaskData::responseHeaders(), QThread::start(), and KDSoapThreadTaskData::waitForCompletion().
Referenced by asyncCall().
void KDSoapClientInterface::callNoReply | ( | const QString & | method, |
const KDSoapMessage & | message, | ||
const QString & | soapAction = QString() , |
||
const KDSoapHeaders & | headers = KDSoapHeaders() |
||
) |
Calls the method method
on this interface and passes the parameters specified in message
to the method.
method | the method name, without arguments. For instance "addContact" . Only used in RPC style. |
message | arguments for the method call |
soapAction | optional "SoapAction" header, see the specification of the SOAP service. You are strongly encouraged to pass a value here, even if it's just "", given that by default (for a null string) KDSoap will generate a SOAPAction for backwards compatibility reasons. |
headers | optional arguments which will be passed as <soap:Header> . |
This is an asynchronous call, where the caller does not want to wait for a response. The method returns immediately, the call is performed later. No error handling is possible.
Definition at line 203 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::accessManager(), QObject::connect(), QBuffer::data(), QObject::deleteLater(), QNetworkReply::finished(), maybeDebugRequest(), QNetworkAccessManager::post(), KDSoapClientInterfacePrivate::prepareRequest(), KDSoapClientInterfacePrivate::prepareRequestBuffer(), QNetworkReply::request(), and KDSoapClientInterfacePrivate::setupReply().
QNetworkCookieJar * KDSoapClientInterface::cookieJar | ( | ) | const |
Returns the cookie jar to use for the HTTP requests. If no cookie jar was set by setCookieJar previously, a default one will be returned, which belongs to the client interface (no need to delete it).
Definition at line 318 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::accessManager(), and QNetworkAccessManager::cookieJar().
QString KDSoapClientInterface::endPoint | ( | ) | const |
Returns the end point of the SOAP service.
Definition at line 225 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_endPoint.
Referenced by KDSoapClientInterface(), and setEndPoint().
void KDSoapClientInterface::ignoreSslErrors | ( | ) |
Asks Qt to ignore ssl errors in https requests. Use this for testing only!
Definition at line 241 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_ignoreSslErrors.
ignoreSslErrors If this function is called, the SSL errors given in errors
will be ignored. Note that you can set the expected certificate in the SSL error. See QNetworkReply::ignoreSslErrors() for more information.
errors | list of errors to ignore |
Definition at line 247 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_ignoreErrorsList.
KDSoapHeaders KDSoapClientInterface::lastResponseHeaders | ( | ) | const |
Returns the headers returned by the last synchronous call(). For asyncCall(), use KDSoapPendingCall::returnHeaders().
Definition at line 303 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_lastResponseHeaders.
|
delete |
QNetworkProxy KDSoapClientInterface::proxy | ( | ) | const |
Returns the network proxy used for the HTTP requests.
Definition at line 335 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::accessManager(), and QNetworkAccessManager::proxy().
Referenced by setProxy().
bool KDSoapClientInterface::sendSoapActionInHttpHeader | ( | ) | const |
sendActionInHTTP_Header
Definition at line 361 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_sendSoapActionInHttpHeader.
bool KDSoapClientInterface::sendSoapActionInWsAddressingHeader | ( | ) | const |
sendSoapActionInWsAddressingHeader
Definition at line 371 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_sendSoapActionInWsAddressingHeader.
void KDSoapClientInterface::setAuthentication | ( | const KDSoapAuthentication & | authentication | ) |
Provide the necessary authentication for this service.
authentication | the authentication data |
Definition at line 220 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_authentication.
void KDSoapClientInterface::setCookieJar | ( | QNetworkCookieJar * | jar | ) |
Sets the cookie jar to use for the HTTP requests. The ownership of the cookie jar is NOT transferred, so that it is possible to share the same cookie jar between multiple client interfaces.
Definition at line 323 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::accessManager(), QObject::parent(), QNetworkAccessManager::setCookieJar(), and QObject::setParent().
void KDSoapClientInterface::setEndPoint | ( | const QString & | endPoint | ) |
Sets the end point of the SOAP service.
endPoint | the URL of the SOAP service, including http or https scheme, port number if needed, and path. Example: http://server/path/soap.php |
Definition at line 230 of file KDSoapClientInterface.cpp.
References endPoint(), and KDSoapClientInterfacePrivate::m_endPoint.
void KDSoapClientInterface::setHeader | ( | const QString & | name, |
const KDSoapMessage & | header | ||
) |
Sets a persistent header, which will be sent with any subsequent SOAP call.
name | internal name, used to replace any existing header previously set with this name |
header | the actual message to be sent |
Definition at line 235 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_persistentHeaders.
void KDSoapClientInterface::setMessageAddressingProperties | ( | const KDSoapMessageAddressingProperties & | map | ) |
Sets the message addressing properties that will be written in the header for all future messages. This method is useful for client code generated from WSDL. Note that this takes precedence over KDSoapMessage::setMessageAddressingProperties.
Definition at line 355 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_hasMessageAddressingProperties, and KDSoapClientInterfacePrivate::m_messageAddressingProperties.
void KDSoapClientInterface::setProxy | ( | const QNetworkProxy & | proxy | ) |
Sets the network proxy used for the HTTP requests.
Definition at line 340 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::accessManager(), proxy(), and QNetworkAccessManager::setProxy().
void KDSoapClientInterface::setRawHTTPHeaders | ( | const QMap< QByteArray, QByteArray > & | headers | ) |
Sets additional HTTP headers in the requests
Definition at line 330 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_httpHeaders.
void KDSoapClientInterface::setSendSoapActionInHttpHeader | ( | bool | sendInHttpHeader | ) |
setSendSoapActionInHttpHeader
sendInHttpHeader | This option can be used to enable/disable the sending of the SOAP action parameter in the Content-Type HTTP header (in the case of SOAP 1.2 requests). It might be necessary to disable it for certain SOAP server implementations in the case if the action is passed in the SOAP envelope's header with WS-Addressing. |
Definition at line 366 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_sendSoapActionInHttpHeader.
void KDSoapClientInterface::setSendSoapActionInWsAddressingHeader | ( | bool | sendInWsAddressingHeader | ) |
setSendSoapActionInWsAddressingHeader
sendInWsAddressingHeader | This function can be used to enable/disable the sending of the SOAP action embedded to the request's SOAP envelope header. See the headers of the WS-Addressing: https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/messaging-protocols#message-addressing-headers |
Definition at line 376 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_sendSoapActionInWsAddressingHeader.
void KDSoapClientInterface::setSoapVersion | ( | KDSoapClientInterface::SoapVersion | version | ) |
Sets the SOAP version to be used for any subsequent SOAP call.
Definition at line 43 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_version.
void KDSoapClientInterface::setSslConfiguration | ( | const QSslConfiguration & | config | ) |
Sets the ssl configuration used for outgoing connections
Definition at line 387 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_sslConfiguration.
void KDSoapClientInterface::setStyle | ( | KDSoapClientInterface::Style | style | ) |
Sets the WSDL style used by this service.
Definition at line 308 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_style, and style().
void KDSoapClientInterface::setTimeout | ( | int | msecs | ) |
Sets the timeout used for future requests, in milliseconds. A negative value disables the timeout feature.
Definition at line 350 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_timeout.
KDSoapClientInterface::SoapVersion KDSoapClientInterface::soapVersion | ( | ) | const |
Returns the version of SOAP being used in this instance.
Definition at line 48 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_version.
QSslConfiguration KDSoapClientInterface::sslConfiguration | ( | ) | const |
Returns the ssl configuration used for outgoing connections
Definition at line 382 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_sslConfiguration.
KDSoapSslHandler * KDSoapClientInterface::sslHandler | ( | ) | const |
Returns the ssl handler object, which can be used for notification and handling of SSL errors.
Note that the notifications from synchronous calls will come in delayed, after the synchronous call failed. For this reason, it is not possible to ignore specific ssl errors during runtime when using synchronous calls. Use asynchronous calls instead.
Definition at line 392 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_sslHandler.
KDSoapClientInterface::Style KDSoapClientInterface::style | ( | ) | const |
Returns the WSDL style used by this service.
Definition at line 313 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_style.
Referenced by setStyle().
int KDSoapClientInterface::timeout | ( | ) | const |
Returns the timeout used for requests, in milliseconds. The default timeout is 30 minutes.
Definition at line 345 of file KDSoapClientInterface.cpp.
References KDSoapClientInterfacePrivate::m_timeout.