30 m_messageNamespace = ns;
34 const QMap<QString, KDSoapMessage> &persistentHeaders,
const KDSoapAuthentication &authentication)
const
37 QXmlStreamWriter writer(&data);
38 writer.writeStartDocument();
54 writer.writeStartElement(soapEnvelope, QLatin1String(
"Envelope"));
59 QString messageNamespace = m_messageNamespace;
68 namespacePrefixes.
writeNamespace(writer, messageNamespace, QLatin1String(
"n1") );
69 writer.writeStartElement(soapEnvelope, QLatin1String(
"Header"));
70 for (
const KDSoapMessage &header : qAsConst(persistentHeaders)) {
71 header.writeChildren(namespacePrefixes, writer, header.use(), messageNamespace,
true);
74 header.writeChildren(namespacePrefixes, writer, header.use(), messageNamespace,
true);
79 if (authentication.hasWSUsernameTokenHeader()) {
80 authentication.writeWSUsernameTokenHeader(writer);
82 writer.writeEndElement();
86 namespacePrefixes.insert(messageNamespace, QString::fromLatin1(
"n1"));
89 writer.writeStartElement(soapEnvelope, QLatin1String(
"Body"));
91 const QString elementName = !method.isEmpty() ? method : message.
name();
92 if (elementName.isEmpty()) {
93 if (message.isNull()) {
96 qWarning(
"ERROR: Non-empty message with an empty name!");
103 writer.writeStartElement(messageNamespace, elementName);
106 writer.writeStartElement(soapEnvelope, elementName);
108 message.writeElementContents(namespacePrefixes, writer, message.
use(), messageNamespace);
109 writer.writeEndElement();
111 writer.writeEndElement();
112 writer.writeEndElement();
113 writer.writeEndDocument();
KDSoapAddressingNamespace addressingNamespace() const
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)
bool hasMessageAddressingProperties() const
KDSoapMessageAddressingProperties messageAddressingProperties() const
static QString soapEncoding()
static QString soapEnvelope()
static QString soapEnvelope200305()
static QString soapEncoding200305()
void writeStandardNamespaces(QXmlStreamWriter &writer, KDSoap::SoapVersion version=KDSoap::SOAP1_1, bool messageAddressingEnabled=false, KDSoapMessageAddressingProperties::KDSoapAddressingNamespace messageAddressingNamespace=KDSoapMessageAddressingProperties::Addressing200508)
void writeNamespace(QXmlStreamWriter &writer, const QString &ns, const QString &prefix)
QString namespaceUri() const