本文整理汇总了C++中KDSoapMessage::hasMessageAddressingProperties方法的典型用法代码示例。如果您正苦于以下问题:C++ KDSoapMessage::hasMessageAddressingProperties方法的具体用法?C++ KDSoapMessage::hasMessageAddressingProperties怎么用?C++ KDSoapMessage::hasMessageAddressingProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KDSoapMessage
的用法示例。
在下文中一共展示了KDSoapMessage::hasMessageAddressingProperties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: messageToXml
QByteArray KDSoapMessageWriter::messageToXml(const KDSoapMessage &message, const QString &method,
const KDSoapHeaders &headers, const QMap<QString, KDSoapMessage> &persistentHeaders) const
{
QByteArray data;
QXmlStreamWriter writer(&data);
writer.writeStartDocument();
KDSoapNamespacePrefixes namespacePrefixes;
namespacePrefixes.writeStandardNamespaces(writer, m_version, message.hasMessageAddressingProperties());
QString soapEnvelope;
QString soapEncoding;
if (m_version == KDSoapClientInterface::SOAP1_1) {
soapEnvelope = KDSoapNamespaceManager::soapEnvelope();
soapEncoding = KDSoapNamespaceManager::soapEncoding();
} else if (m_version == KDSoapClientInterface::SOAP1_2) {
soapEnvelope = KDSoapNamespaceManager::soapEnvelope200305();
soapEncoding = KDSoapNamespaceManager::soapEncoding200305();
}
writer.writeStartElement(soapEnvelope, QLatin1String("Envelope"));
// This has been removed, see http://msdn.microsoft.com/en-us/library/ms995710.aspx for details
//writer.writeAttribute(soapEnvelope, QLatin1String("encodingStyle"), soapEncoding);
QString messageNamespace = m_messageNamespace;
if (!message.namespaceUri().isEmpty() && messageNamespace != message.namespaceUri()) {
messageNamespace = message.namespaceUri();
}
if (!headers.isEmpty() || !persistentHeaders.isEmpty() || message.hasMessageAddressingProperties()) {
// This writeNamespace line adds the xmlns:n1 to <Envelope>, which looks ugly and unusual (and breaks all unittests)
// However it's the best solution in case of headers, otherwise we get n1 in the header and n2 in the body,
// and xsi:type attributes that refer to n1, which isn't defined in the body...
namespacePrefixes.writeNamespace(writer, messageNamespace, QLatin1String("n1") /*make configurable?*/);
writer.writeStartElement(soapEnvelope, QLatin1String("Header"));
Q_FOREACH (const KDSoapMessage &header, persistentHeaders) {
header.writeChildren(namespacePrefixes, writer, header.use(), messageNamespace, true);
}