コード例 #1
0
ファイル: msexchange_wsdl.cpp プロジェクト: nbeudez/KDSoap
    void testGetFolder() // SOAP-87
    {
        HttpServerThread server(queryResponse(), HttpServerThread::Public);
        ExchangeServices service(this);
        service.setEndPoint(server.endPoint());

        TNS__GetFolderType request;

        //folder shape
        T__FolderResponseShapeType folderShape;
        folderShape.setBaseShape(T__DefaultShapeNamesType::IdOnly);
        T__PathToUnindexedFieldType *pathToUnindexedField = new T__PathToUnindexedFieldType; // ownership will transfer to QSharedPointer
        pathToUnindexedField->setFieldURI(T__UnindexedFieldURIType::Folder_TotalCount);
        QList< QSharedPointer<T__BasePathToElementType> > paths;
        paths.append(QSharedPointer<T__BasePathToElementType>(pathToUnindexedField));
        T__NonEmptyArrayOfPathsToElementType additionalProperties;
        additionalProperties.setPath(paths);
        folderShape.setAdditionalProperties(additionalProperties);
        request.setFolderShape(folderShape);

        //folder id
        T__DistinguishedFolderIdType distinguishedFolderId;
        distinguishedFolderId.setId(T__DistinguishedFolderIdNameType::Calendar);
        T__EmailAddressType mailbox;
        mailbox.setEmailAddress(QString("*****@*****.**"));
        distinguishedFolderId.setMailbox(mailbox);
        QList<T__DistinguishedFolderIdType> distinguishedFolderIds;
        distinguishedFolderIds.append(distinguishedFolderId);
        T__NonEmptyArrayOfBaseFolderIdsType folderIds;
        folderIds.setDistinguishedFolderId(distinguishedFolderIds);
        request.setFolderIds(folderIds);

        //request folder
        service.getFolder(request);

        // Check what we sent
        QByteArray expectedRequestXml =
            QByteArray(xmlEnvBegin11()) + ">"
                "<soap:Body>"
                "<n1:GetFolder xmlns:n1=\"http://schemas.microsoft.com/exchange/services/2006/messages\">"
                  "<n1:FolderShape>"
                    "<n2:BaseShape xmlns:n2=\"http://schemas.microsoft.com/exchange/services/2006/types\">IdOnly</n2:BaseShape>"
                    "<n3:AdditionalProperties xmlns:n3=\"http://schemas.microsoft.com/exchange/services/2006/types\">"
                    "<n3:FieldURI FieldURI=\"folder:TotalCount\"/>"
                    "</n3:AdditionalProperties>"
                  "</n1:FolderShape>"
                  "<n1:FolderIds>"
                    "<n4:DistinguishedFolderId xmlns:n4=\"http://schemas.microsoft.com/exchange/services/2006/types\" Id=\"calendar\">"
                      "<n4:Mailbox>"
                        "<n4:EmailAddress>[email protected]</n4:EmailAddress>"
                      "</n4:Mailbox>"
                    "</n4:DistinguishedFolderId>"
                  "</n1:FolderIds>"
                "</n1:GetFolder>"
                "</soap:Body>" + xmlEnvEnd()
            + '\n'; // added by QXmlStreamWriter::writeEndDocument
        QVERIFY(xmlBufferCompare(server.receivedData(), expectedRequestXml));
    }
コード例 #2
0
ファイル: msexchange_wsdl.cpp プロジェクト: nbeudez/KDSoap
 T__TargetFolderIdType targetFolder()
 {
     T__TargetFolderIdType folder;
     T__DistinguishedFolderIdType distinguishedFolder;
     distinguishedFolder.setId(T__DistinguishedFolderIdNameType::Calendar);
     T__EmailAddressType mailbox;
     mailbox.setEmailAddress(QString("*****@*****.**"));
     distinguishedFolder.setMailbox(mailbox);
     folder.setDistinguishedFolderId(distinguishedFolder);
     return folder;
 }
コード例 #3
0
ファイル: msexchange_wsdl.cpp プロジェクト: hporten/KDSoap
    void testCharactersSequenceValidOrInvalid_data() // We use a token within <subject> to later replace by a valid or invalid characters
    {
        const QString serverResponseXML = "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">"
                "<s:Header>"
                   "<h:ServerVersionInfo MajorVersion=\"15\" MinorVersion=\"0\" MajorBuildNumber=\"995\" MinorBuildNumber=\"28\" Version=\"V2_15\" xmlns:h=\"http://schemas.microsoft.com/exchange/services/2006/types\" xmlns=\"http://schemas.microsoft.com/exchange/services/2006/types\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>"
                "</s:Header>"
                "<s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"
                   "<m:SyncFolderItemsResponse xmlns:m=\"http://schemas.microsoft.com/exchange/services/2006/messages\" xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\">"
                      "<m:ResponseMessages>"
                         "<m:SyncFolderItemsResponseMessage ResponseClass=\"Success\">"
                            "<m:ResponseCode>NoError</m:ResponseCode>"
                            "<m:SyncState>H4sIAAAAAAAEAGNgYGcAAotqE0tHE2NTA0ddZ3NHC10TR2djXSdnJ2ddNyMnC2cnczdLU1OD2vBgveDKvOTgksSSVOfEvMSiSgYr0nW65eekpBZ5pjBYkq43LLWoODM/j8GaaK3+QMuKS4JSk1Mzy1JTQjJzU0nwrU9icYlnXnFJYl5yqncqKb71zS9K9SxJzS32zwtOLSpLLSLByXDfhgNxUW5iUTYklrgYGISA0tDwAxkOUskgCJQyAGI9kJqwW2wmEwW3eq1Q4DWONF+xh5HBY/WkZAUxe7elE6ZFHb2QsgSoiL2ukIGBkYGPgRmkhZtBPOh3mQjTJQ8GIaAoLxADratiZGDwdQzw9HX0AylicDN1CwMrRwOtQFyBxP8LxNZY1FkAzTND4h9pWa2bq7XWtWXCjw3TL5y/CDI7COiqq+d0AhjuhbDvVqvn8J2s/69qrtKPvWxgLYwMdy6UycUyyHnvb5dd9O3xSrMgqLh5t+3sbxhGwmQZGICGMtw+bWlxXmWD/4wd29SnTd+1HC671ef0M4xQQuidI7AMw2RWoPjFOU4CjYymTnZznTzmBzDcTfxyXjSuyadr1dFH2h2bvrMx7FiaXtJGwFG4PGr7krEBANRZ2yGcAwAA</m:SyncState>"
                            "<m:IncludesLastItemInRange>true</m:IncludesLastItemInRange>"
                            "<m:Changes>"
                               "<t:Create>"
                                  "<t:Message>"
                                     "<t:ItemId Id=\"AAMkAGNiY2YxMjY3LTUxYjgtNGI1Yy1hOTM2LTU4MTM5OTZiNjdjYgBGAAAAAABW2gY0kRG1SqggDTNZN6i8BwBIq5JjIBY/RqWQllrF0GSkAAAAB35xAADdYfTPFV6CTIqqxeIriLL3ALilZ3SGAAA=\" ChangeKey=\"CQAAABYAAADEhKstbSqtRYSQ+LCX0M/RAAAAY37E\"/>"
                                     "<t:Subject>subject %1</t:Subject>"
                                     "<t:Sensitivity>Normal</t:Sensitivity>"
                                     "<t:Size>14070</t:Size>"
                                     "<t:DateTimeSent>2014-10-02T13:24:47Z</t:DateTimeSent>"
                                     "<t:DateTimeCreated>2014-10-02T13:24:49Z</t:DateTimeCreated>"
                                     "<t:HasAttachments>false</t:HasAttachments>"
                                     "<t:From>"
                                        "<t:Mailbox>"
                                           "<t:Name>Simon Hain</t:Name>"
                                           "<t:EmailAddress>[email protected]</t:EmailAddress>"
                                           "<t:RoutingType>SMTP</t:RoutingType>"
                                        "</t:Mailbox>"
                                     "</t:From>"
                                     "<t:IsRead>true</t:IsRead>"
                                  "</t:Message>"
                               "</t:Create>"
                            "</m:Changes>"
                         "</m:SyncFolderItemsResponseMessage>"
                      "</m:ResponseMessages>"
                   "</m:SyncFolderItemsResponse>"
                "</s:Body>"
             "</s:Envelope>";

        TNS__GetFolderType request;
        T__FolderResponseShapeType folderShape;
        folderShape.setBaseShape(T__DefaultShapeNamesType::IdOnly);
        request.setFolderShape(folderShape);

        T__NonEmptyArrayOfBaseFolderIdsType folderIds;
        QList<T__DistinguishedFolderIdType> distinguishedFolderIds;
        T__DistinguishedFolderIdType distinguishedFolder;
        distinguishedFolder.setId(T__DistinguishedFolderIdNameType::Inbox);
        distinguishedFolderIds.append(distinguishedFolder);
        folderIds.setDistinguishedFolderId(distinguishedFolderIds);
        request.setFolderIds(folderIds);

        QTest::addColumn<QString>("serverResponseXml");
        QTest::addColumn<TNS__GetFolderType>("request");
        QTest::addColumn<QString>("expectedResult");

        QTest::newRow("invalid 13") << serverResponseXML.arg("&#x13;") << request << QString("subject ?");
        QTest::newRow("valid A") << serverResponseXML.arg("&#x41;") << request << QString("subject A");
        QTest::newRow("valid B") << serverResponseXML.arg("&#x42;") << request << QString("subject B");
        QTest::newRow("valid_single_quote") << serverResponseXML.arg("&#039;") << request << QString("subject '");
    }
コード例 #4
0
ファイル: msexchange_wsdl.cpp プロジェクト: hporten/KDSoap
    void testServerVersionInfo() // SOAP-116
    {
        QByteArray serverResponseXml =
                "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">"
                   "<s:Header>"
                     "<h:ServerVersionInfo MajorVersion=\"15\" MinorVersion=\"0\" MajorBuildNumber=\"995\" MinorBuildNumber=\"28\" Version=\"V2_15\" xmlns:h=\"http://schemas.microsoft.com/exchange/services/2006/types\" xmlns=\"http://schemas.microsoft.com/exchange/services/2006/types\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>"
                   "</s:Header>"
                   "<s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"
                      "<m:SyncFolderItemsResponse xmlns:m=\"http://schemas.microsoft.com/exchange/services/2006/messages\" xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\">"
                         "<m:ResponseMessages>"
                            "<m:SyncFolderItemsResponseMessage ResponseClass=\"Success\">"
                               "<m:ResponseCode>NoError</m:ResponseCode>"
                               "<m:SyncState>H4sIAAAAAAAEAGNgYGcAAotqE0tHE2NTA0ddZ3NHC10TR2djXSdnJ2ddNyMnC2cnczdLU1OD2vBgveDKvOTgksSSVOfEvMSiSgYr0nW65eekpBZ5pjBYkq43LLWoODM/j8GaaK3+QMuKS4JSk1Mzy1JTQjJzU0nwrU9icYlnXnFJYl5yqncqKb71zS9K9SxJzS32zwtOLSpLLSLByXDfhgNxUW5iUTYklrgYGISA0tDwAxkOUskgCJQyAGI9kJqwW2wmEwW3eq1Q4DWONF+xh5HBY/WkZAUxe7elE6ZFHb2QsgSoiL2ukIGBkYGPgRmkhZtBPOh3mQjTJQ8GIaAoLxADratiZGDwdQzw9HX0AylicDN1CwMrRwOtQFyBxP8LxNZY1FkAzTND4h9pWa2bq7XWtWXCjw3TL5y/CDI7COiqq+d0AhjuhbDvVqvn8J2s/69qrtKPvWxgLYwMdy6UycUyyHnvb5dd9O3xSrMgqLh5t+3sbxhGwmQZGICGMtw+bWlxXmWD/4wd29SnTd+1HC671ef0M4xQQuidI7AMw2RWoPjFOU4CjYymTnZznTzmBzDcTfxyXjSuyadr1dFH2h2bvrMx7FiaXtJGwFG4PGr7krEBANRZ2yGcAwAA</m:SyncState>"
                               "<m:IncludesLastItemInRange>true</m:IncludesLastItemInRange>"
                               "<m:Changes>"
                                  "<t:Create>"
                                     "<t:Message>"
                                        "<t:ItemId Id=\"AAMkAGNiY2YxMjY3LTUxYjgtNGI1Yy1hOTM2LTU4MTM5OTZiNjdjYgBGAAAAAABW2gY0kRG1SqggDTNZN6i8BwBIq5JjIBY/RqWQllrF0GSkAAAAB35xAADdYfTPFV6CTIqqxeIriLL3ALilZ3SGAAA=\" ChangeKey=\"CQAAABYAAADEhKstbSqtRYSQ+LCX0M/RAAAAY37E\"/>"
                                        "<t:Subject>Freedom</t:Subject>"
                                        "<t:Sensitivity>Normal</t:Sensitivity>"
                                        "<t:Size>14070</t:Size>"
                                        "<t:DateTimeSent>2014-10-02T13:24:47Z</t:DateTimeSent>"
                                        "<t:DateTimeCreated>2014-10-02T13:24:49Z</t:DateTimeCreated>"
                                        "<t:HasAttachments>false</t:HasAttachments>"
                                        "<t:From>"
                                           "<t:Mailbox>"
                                              "<t:Name>Simon Hain</t:Name>"
                                              "<t:EmailAddress>[email protected]</t:EmailAddress>"
                                              "<t:RoutingType>SMTP</t:RoutingType>"
                                           "</t:Mailbox>"
                                        "</t:From>"
                                        "<t:IsRead>true</t:IsRead>"
                                     "</t:Message>"
                                  "</t:Create>"
                               "</m:Changes>"
                            "</m:SyncFolderItemsResponseMessage>"
                         "</m:ResponseMessages>"
                      "</m:SyncFolderItemsResponse>"
                   "</s:Body>"
                "</s:Envelope>";

        HttpServerThread server(serverResponseXml, HttpServerThread::Public);
        ExchangeServices service(this);
        service.setEndPoint(server.endPoint());

        GetFolderJob* job = new GetFolderJob(&service);
        TNS__GetFolderType request;
        T__FolderResponseShapeType folderShape;
        folderShape.setBaseShape(T__DefaultShapeNamesType::IdOnly);
        request.setFolderShape(folderShape);

        T__NonEmptyArrayOfBaseFolderIdsType folderIds;
        QList<T__DistinguishedFolderIdType> distinguishedFolderIds;
        T__DistinguishedFolderIdType distinguishedFolder;
        distinguishedFolder.setId(T__DistinguishedFolderIdNameType::Inbox);
        distinguishedFolderIds.append(distinguishedFolder);
        folderIds.setDistinguishedFolderId(distinguishedFolderIds);
        request.setFolderIds(folderIds);

        QEventLoop loop;
        QObject::connect(job, SIGNAL(finished(KDSoapJob*)), &loop, SLOT(quit()));
        job->setRequest(request);
        job->start();
        loop.exec();

        // comapring with "<h:ServerVersionInfo MajorVersion=\"15\" MinorVersion=\"0\" MajorBuildNumber=\"995\" MinorBuildNumber=\"28\" Version=\"V2_15\" [...]
        QCOMPARE(job->serverVersion().majorVersion(), 15);
        QCOMPARE(job->serverVersion().majorBuildNumber(), 995);
        QCOMPARE(job->serverVersion().minorVersion(), 0);
        QCOMPARE(job->serverVersion().minorBuildNumber(), 28);
        QCOMPARE(job->serverVersion().version(), QString("V2_15"));
    }