当前位置: 首页>>代码示例>>C++>>正文


C++ KDSoapMessage::hasMessageAddressingProperties方法代码示例

本文整理汇总了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);
        }
开发者ID:REC-SPb-ETU,项目名称:KDSoap,代码行数:39,代码来源:KDSoapMessageWriter.cpp


注:本文中的KDSoapMessage::hasMessageAddressingProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。