 |
KD SOAP
2.0.0
|
KDSoapUdpClient provides an interface for implementing a SOAP-over-UDP client.
More...
#include <KDSoapUdpClient.h>
|
bool | bind (quint16 port=0, QAbstractSocket::BindMode mode=QAbstractSocket::DefaultForPlatform) |
|
void | setSoapVersion (KDSoap::SoapVersion version) |
|
KDSoapUdpClient provides an interface for implementing a SOAP-over-UDP client.
One-way SOAP-over-UDP can be send by simply using sendMessage().
Request-response SOAP-over-UDP is supported by bind()ing to a sender UDP port. You can send the request using sendMessage() and the response will is signaled using receivedMessage(). receivedMessage() will signal any response, including those of other requests, there is no help with finding the correct response. The WS-Addressing properties of the message can be used to filter the received responses.
QStringLiteral("http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/ProbeMatches")) { TNS__ProbeMatchesType probeMatches;
probeMatches.deserialize(message);
qDebug() << "Received probe match from" << address;
}
});
soapUdpClient->bind(3702);
TNS__ProbeType probe;
message = probe.serialize(QStringLiteral("Probe"));
message.
setNamespaceUri(QStringLiteral(
"http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01"));
addressing.
setAction(QStringLiteral(
"http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Probe"));
addressing.
setDestination(QStringLiteral(
"urn:docs-oasis-open-org:ws-dd:ns:discovery:2009:01"));
soapUdpClient->sendMessage(message,
KDSoapHeaders(), QHostAddress(
"239.255.255.250"), 3702);
- Since
- 1.9
◆ bind()
bool KDSoapUdpClient::bind |
( |
quint16 |
port = 0 , |
|
|
QAbstractSocket::BindMode |
mode = QAbstractSocket::DefaultForPlatform |
|
) |
| |
Bind UDP socket to port. This is needed to receive messages. Both the IPv4 and IPv6 port will be bound.
- Parameters
-
port | The UDP port to bind to. When port is 0, a random port is chosen. |
mode | This is passed directly to QUdpSocket::bind(). |
- See also
- receivedMessage()
- Since
- 1.9
◆ setSoapVersion()
void KDSoapUdpClient::setSoapVersion |
( |
KDSoap::SoapVersion |
version | ) |
|
Sets the SOAP version to be used for any subsequent send message.
- Parameters
-
version | SOAP1_1 or SOAP1_2 The default version is SOAP 1.2. |
◆ sendMessage
bool KDSoapUdpClient::sendMessage |
( |
const KDSoapMessage & |
message, |
|
|
const KDSoapHeaders & |
headers, |
|
|
const QHostAddress & |
address, |
|
|
quint16 |
port |
|
) |
| |
|
slot |
Send a SOAP-over-UDP message to IP address.
- Parameters
-
message | The actual message to be send. Use KDSoapMessage::setMessageAddressingProperties() to set the WS-Addressing properties of the message. |
headers | can be used to add additional SOAP headers. |
address | The address to send to message to. Messages send to a multicast address will be send to all interfaces. |
port | The UDP port to send the message to |
- Since
- 1.9
◆ receivedMessage
void KDSoapUdpClient::receivedMessage |
( |
const KDSoapMessage & |
message, |
|
|
const KDSoapHeaders & |
headers, |
|
|
const QHostAddress & |
address, |
|
|
quint16 |
port |
|
) |
| |
|
signal |
emitted when a SOAP-over-UDP message is received over a bound socket. KDSoapUdpClient doesn't do any filtering, so duplicate messages, spoofed or responses to other requests will all be received. For example, if a message is send via both IPv4 and IPv6, then the receivedMessage will be emitted twice (with the same message, but with a different address)
- Parameters
-
message | The parsed message received over the socket. Use KDSoapMessage::messageAddressingProperties() to see who the recipient is and what SOAP action is requested. |
headers | The additional headers of the message |
address | The IP-address of the sender |
port | The UDP port of the sender |
- See also
- bind()
- Since
- 1.9
The documentation for this class was generated from the following files:
- /home/allen/projects/kdsoap/src/KDSoapClient/KDSoapUdpClient.h
- /home/allen/projects/kdsoap/src/KDSoapClient/KDSoapUdpClient.cpp
void setMessageID(const QString &id)
Definition: KDSoapMessageAddressingProperties.cpp:145
@ LiteralUse
data is serialized according to a given schema, no xsi:type attributes are written out
Definition: KDSoapValue.h:273
QString action() const
Definition: KDSoapMessageAddressingProperties.cpp:70
static QString predefinedAddressToString(KDSoapAddressingPredefinedAddress address, KDSoapAddressingNamespace addressingNamespace=Addressing200508)
Definition: KDSoapMessageAddressingProperties.cpp:213
KDSoapMessageAddressingProperties messageAddressingProperties() const
Definition: KDSoapMessage.cpp:179
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Definition: KDSoapMessage.h:35
void setAction(const QString &action)
Definition: KDSoapMessageAddressingProperties.cpp:75
Definition: KDSoapMessageAddressingProperties.h:82
void setMessageAddressingProperties(const KDSoapMessageAddressingProperties &map)
Definition: KDSoapMessage.cpp:184
void setReplyEndpointAddress(const QString &replyEndpoint)
Definition: KDSoapMessageAddressingProperties.cpp:115
KDSoapUdpClient provides an interface for implementing a SOAP-over-UDP client.
Definition: KDSoapUdpClient.h:77
void receivedMessage(const KDSoapMessage &message, const KDSoapHeaders &headers, const QHostAddress &address, quint16 port)
void setUse(Use use)
Definition: KDSoapMessage.cpp:200
QString toString() const const
void setNamespaceUri(const QString &ns)
Definition: KDSoapValue.cpp:468
void setDestination(const QString &destination)
Definition: KDSoapMessageAddressingProperties.cpp:65