Unable to capture variables in SAML response body using Jmeter - jmeter

I have question about how to extract the SAML Response in jmeter, i follow these steps but it's not succeed and i don't know where is the problem :
- when i have the login Page, i send post request to the Idp provider to authenticate me (i give him, username and password), after that i will get SAML Response like this :
PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphc3NlcnRpb24iIENvbnNlbnQ9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDpjb25zZW50Om9idGFpbmVkIiBEZXN0aW5hdGlvbj0iaHR0cHM6Ly9hc2Z2Mi1zYXJhaC1kZXYuY2ZhcHBzLnJlbmF1bHQuZnIvc2FtbCIgSUQ9ImlkYWVnaTQtT2ZVcHQzdDZNZVd2RmhVNG92TmZNIiBJblJlc3BvbnNlVG89IklEXzNjNjJkYzZhLTI5N2YtNDM2MS1iYTg3LWIxZjZmMWJmYTUzYSIgSXNzdWVJbnN0YW50PSIyMDE2LTA0LTI1VDExOjMzOjEwWiIgVmVyc2lvbj0iMi4wIj48c2FtbDpJc3N1ZXI+aHR0cHM6Ly92aXJ0dWFsODcyLmxhYnRlY2gucGxzLnJlbmF1bHQuZnI6ODQ0My9uaWRwL3NhbWwyL21ldGFkYXRhPC9zYW1sOklzc3Vlcj48c2FtbHA6U3RhdHVzPjxzYW1scDpTdGF0dXNDb2RlIFZhbHVlPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6c3RhdHVzOlN1Y2Nlc3MiLz48L3NhbWxwOlN0YXR1cz48c2FtbDpBc3NlcnRpb24gSUQ9Imlkb0VBYWlPSnJ1RDBsdkFGdmNQR1R4QTRHWlY4IiBJc3N1ZUluc3RhbnQ9IjIwMTYtMDQtMjVUMTE6MzM6MTFaIiBWZXJzaW9uPSIyLjAiPjxzYW1sOklzc3Vlcj5odHRwczovL3Zpc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cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIE5hbWU9IlJvbGUxIiBOYW1lRm9ybWF0PSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6YXR0cm5hbWUtZm9ybWF0OnVuc3BlY2lmaWVkIj48c2FtbDpBdHRyaWJ1dGVWYWx1ZSB4c2k6dHlwZT0ieHM6c3RyaW5nIj5hZG1pbjwvc2FtbDpBdHRyaWJ1dGVWYWx1ZT48L3NhbWw6QXR0cmlidXRlPjxzYW1sOkF0dHJpYnV0ZSB4bWxuczp4cz0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIE5hbWU9InJlbmNvc3RjZW50ZXIiIE5hbWVGb3JtYXQ9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphdHRybmFtZS1mb3JtYXQ6dW5zcGVjaWZpZWQiPjxzYW1sOkF0dHJpYnV0ZVZhbHVlIHhzaTp0eXBlPSJ4czpzdHJpbmciPkFBNTA4MTU8L3NhbWw6QXR0cmlidXRlVmFsdWU+PC9zYW1sOkF0dHJpYnV0ZT48L3NhbWw6QXR0cmlidXRlU3RhdGVtZW50Pjwvc2FtbDpBc3NlcnRpb24+PC9zYW1scDpSZXNwb25zZT4=
In jmeter i used: post regular expression extractor, i give him this regex to extract the SAMLResponse but it don't work :
name='SAMLResponse' value='([^"]+)'
If anyone can help me ?

This response is base64 encoded. You need to base64 decode this response. Save the response in a file, lets call it idpResponse.
If you have a linux shell run the command below to decode the response:
cat idpResponse | base64 -D
You contents are:
<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
Consent="urn:oasis:names:tc:SAML:2.0:consent:obtained"
Destination="https://asfv2-sarah-dev.cfapps.renault.fr/saml"
ID="idaegi4-OfUpt3t6MeWvFhU4ovNfM"
InResponseTo="ID_3c62dc6a-297f-4361-ba87-b1f6f1bfa53a"
IssueInstant="2016-04-25T11:33:10Z" Version="2.0">
<saml:Issuer>
https://virtual872.labtech.pls.renault.fr:8443/nidp/saml2/metadata</saml:Issuer>
<samlp:Status>
<samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" />
</samlp:Status>
<saml:Assertion ID="idoEAaiOJruD0lvAFvcPGTxA4GZV8"
IssueInstant="2016-04-25T11:33:11Z" Version="2.0">
<saml:Issuer>
https://virtual872.labtech.pls.renault.fr:8443/nidp/saml2/metadata</saml:Issuer>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
<ds:Reference URI="#idoEAaiOJruD0lvAFvcPGTxA4GZV8">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<ds:DigestValue>
JCZ165dScExJIQRJ1G/WcBGrcrg=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
vRmUL8JH4zbU+nMwb9OuVJFYAchodke2E3HJzpbaQBwvFG3fzVMeyWsmgiZYOFG0R9N++yZod0gi
6SEanBEFUMZNrT5YRaEyR6Y7N6Jp5VHS0/YUcjujt7LHOihEgHY7geNMGq9yNFH37aFH6U3xfP42
qfuFAPHgwcLwBj1PgTwIm5FS05I8p/vUBbGb3RTjZlmotDvfXqHrelPsw6niPEi6I7SN7KNtVZUs
tA4bR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Qualifier="https://virtual872.labtech.pls.renault.fr:8443/nidp/saml2/metadata"
SPNameQualifier="https://asfv2-sarah-dev.cfapps.renault.fr">
p080145</saml:NameID>
<saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<saml:SubjectConfirmationData InResponseTo="ID_3c62dc6a-297f-4361-ba87-b1f6f1bfa53a"
NotOnOrAfter="2016-04-25T12:33:10Z"
Recipient="https://asfv2-sarah-dev.cfapps.renault.fr/saml" />
</saml:SubjectConfirmation>
</saml:Subject>
<saml:Conditions NotBefore="2016-04-25T11:28:11Z"
NotOnOrAfter="2016-04-25T11:38:11Z">
<saml:AudienceRestriction>
<saml:Audience>
https://asfv2-sarah-dev.cfapps.renault.fr</saml:Audience>
</saml:AudienceRestriction>
</saml:Conditions>
<saml:AuthnStatement AuthnInstant="2016-04-25T11:33:10Z"
SessionIndex="idoEAaiOJruD0lvAFvcPGTxA4GZV8">
<saml:AuthnContext>
<saml:AuthnContextClassRef>
urn:oasis:names:tc:SAML:2.0:ac:classes:Password</saml:AuthnContextClassRef>
<saml:AuthnContextDeclRef>
secure/name/password/uri</saml:AuthnContextDeclRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
<saml:Attribute xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Name="uid"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
<saml:AttributeValue xsi:type="xs:string">
p080145</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Name="preferredLanguage"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
<saml:AttributeValue xsi:type="xs:string">
FR</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Name="mail"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
<saml:AttributeValue xsi:type="xs:string">
sarah.hadbi#renault.com</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Name="givenName"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
<saml:AttributeValue xsi:type="xs:string">
Sarah</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Name="sn"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
<saml:AttributeValue xsi:type="xs:string">
Hadbi</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Name="cn"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
<saml:AttributeValue xsi:type="xs:string">HADBI
Sarah</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Name="renpersontype"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
<saml:AttributeValue xsi:type="xs:string">
ou=catSTGR,ou=PersonTypes,ou=TechnicalData,o=renault</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Name="Role1"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
<saml:AttributeValue xsi:type="xs:string">
admin</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Name="rencostcenter"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
<saml:AttributeValue xsi:type="xs:string">
AA50815</saml:AttributeValue>
</saml:Attribute>
</saml:AttributeStatement>
</saml:Assertion>
</samlp:Response>

Your regex, name='SAMLResponse' value='([^"]+)' mixes quote types: ' and ". Your matching group matches "anything that isn't a " one or more times, and then a ' afterwards. I suspect that your pattern matches the trailing ', keeps going, and then can't find the ending ' because it already matched it in the ([^"]+).
If you're passing this value back into another request, that should be all you need to change. Otherwise, you'll have to do what Suresh Koya suggests.

use regex:
name='SAMLResponse' value='([\s\S]+?)'

Related

EWS. FindItem operation. How to map response data to the request?

In my app I need to look for messages with certain custom properties. I'm using FindItem operation. This is the XML of my request:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header>
<typ:RequestServerVersion Version="Exchange2010_SP2" />
</soap:Header>
<soap:Body>
<mes:FindItem Traversal="Shallow">
<mes:ItemShape>
<typ:BaseShape>IdOnly</typ:BaseShape>
</mes:ItemShape>
<mes:Restriction>
<typ:Or>
<typ:IsEqualTo>
<typ:ExtendedFieldURI PropertySetId="36603a56-9a21-4e9d-b4b7-6eb13876716a" PropertyName="OriginalId" PropertyType="String" />
<typ:FieldURIOrConstant>
<typ:Constant Value="F33A7D78-5FCB-492E-AE98-D7E1CBB379C7" />
</typ:FieldURIOrConstant>
</typ:IsEqualTo>
<typ:IsEqualTo>
<typ:ExtendedFieldURI PropertySetId="36603a56-9a21-4e9d-b4b7-6eb13876716a" PropertyName="OriginalId" PropertyType="String" />
<typ:FieldURIOrConstant>
<typ:Constant Value="hello-world-135" />
</typ:FieldURIOrConstant>
</typ:IsEqualTo>
<typ:IsEqualTo>
<typ:ExtendedFieldURI PropertySetId="36603a56-9a21-4e9d-b4b7-6eb13876716a" PropertyName="OriginalId" PropertyType="String" />
<typ:FieldURIOrConstant>
<typ:Constant Value="9BA188D5-EC35-4E46-AA0B-1C902F6EE70E" />
</typ:FieldURIOrConstant>
</typ:IsEqualTo>
</typ:Or>
</mes:Restriction>
<mes:ParentFolderIds>
<typ:DistinguishedFolderId Id="sentitems" />
</mes:ParentFolderIds>
</mes:FindItem>
</soap:Body>
</soap:Envelope>
So I'm looking for three messages as you can see. One of them (second one) doesn't exist. So in the response I expected to receive some indication that no data for this specific message was found. But this is what I get in the response:
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo 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" MajorVersion="15" MinorVersion="0" MajorBuildNumber="1365" MinorBuildNumber="1" Version="V2_23" />
</s:Header>
<s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<m:FindItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:FindItemResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:RootFolder TotalItemsInView="2" IncludesLastItemInRange="true">
<t:Items>
<t:Message>
<t:ItemId Id="AAMkADE3MTJkZWNlLTZiYWYtNDY4Yi1hNmM3LWU2MzY2ZDZjYWNhMQBGAAAAAACoXti5FFu8TJNLLS5k9vC8BwAcJDq8WkSCQ77jdOtyazgnAAAAAAEJAAAcJDq8WkSCQ77jdOtyazgnAAEJ1zgKAAA=" ChangeKey="CQAAABYAAAAcJDq8WkSCQ77jdOtyazgnAAEJ7PHv" />
</t:Message>
<t:Message>
<t:ItemId Id="AAMkADE3MTJkZWNlLTZiYWYtNDY4Yi1hNmM3LWU2MzY2ZDZjYWNhMQBGAAAAAACoXti5FFu8TJNLLS5k9vC8BwAcJDq8WkSCQ77jdOtyazgnAAAAAAEJAAAcJDq8WkSCQ77jdOtyazgnAAEJ1zgJAAA=" ChangeKey="CQAAABYAAAAcJDq8WkSCQ77jdOtyazgnAAEJ7PHs" />
</t:Message>
</t:Items>
</m:RootFolder>
</m:FindItemResponseMessage>
</m:ResponseMessages>
</m:FindItemResponse>
</s:Body>
</s:Envelope>
Only two messages and no indication which ones in the request they belong to. So how am I supposed to map the two found messages to the data in request? Are the messages in the response actually 1 and 2? 2 and 3? or 1 and 3 (which is true in this case)? Do you see my confusion? Obviously I'm doing something wrong. There should be a way to map the data easily. How should I build the request the proper way?
UPDATE:
What I also tried was making a separate FindItem node for each message but unfortunately this didn't work either. The response contained data only for the first item
Your ItemShape element caninclude AdditionalProperties element where you can specify your custom properties, such as "OriginalId".

Can't create Tasks inside task folder using ews in exchange online

I am trying to create the tasks using ews but it is giving ErrorInvalidIdMalformed error.
I have already tried using wellknownfolders name and with task folder id but I am not able to create task
email_id = "xyz#pqr.onmicrosoft.com"
folder_id = "tasks"
# or folder_id="id of some task folder"
RestoreTASK = b'''<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header>
<t:RequestServerVersion Version="Exchange2007_SP1" />
<t:ExchangeImpersonation>
<t:ConnectingSID>
%s
</t:ConnectingSID>
</t:ExchangeImpersonation>
</soap:Header>
<soap:Body>
<CreateItem
xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
MessageDisposition="SaveOnly">
<SavedItemFolderId>
<t:FolderId Id="%s"/>
</SavedItemFolderId>
<Items>
<t:Task>
<t:Subject>My task EWS</t:Subject>
<t:DueDate>2006-10-26T21:32:52</t:DueDate>
<t:Status>NotStarted</t:Status>
</t:Task>
</Items>
</CreateItem>
</soap:Body>
</soap:Envelope>''' % (email_id, folder_id)
ews_api_url = 'https://outlook.office365.com/EWS/Exchange.asmx'
response = requests.post(url=ews_api_url, headers = headers,
data=RestoreTASK)
So do I need to make changes in my soap request because folder id that I am specifing manually is correct.
Please help.
The error is telling you the folderId is wrong so how do you know its correct ? How did you retrieve the FolderId in the first place ? eg a simple test of you XML with DistinguishedFolderId works fine
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header>
<t:RequestServerVersion Version="Exchange2007_SP1" />
</soap:Header>
<soap:Body>
<CreateItem
xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
MessageDisposition="SaveOnly">
<SavedItemFolderId>
<t:DistinguishedFolderId Id="tasks"/>
</SavedItemFolderId>
<Items>
<t:Task>
<t:Subject>My task EWS</t:Subject>
<t:DueDate>2006-10-26T21:32:52</t:DueDate>
<t:Status>NotStarted</t:Status>
</t:Task>
</Items>
</CreateItem>
</soap:Body>
</soap:Envelope>

Specifying multiple ids (AlternateId ) in the ConvertId EWS request?

I was under an impression that I can pass multiple ids in the ConvertId request. If I send the following request with two ids (they happen to be folder and its child message), I only get one id back.
Sure sounds like a bug...
Request:
<?xml version="1.0" encoding="ISO-8859-1"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header>
<t:RequestServerVersion Version="Exchange2010"/>
</soap:Header>
<soap:Body>
<m:ConvertId DestinationFormat="EwsId">
<m:SourceIds>
<AlternateId Format="EntryId" Id="AAAAAF6BdU8APhVJsGWfKuqS58IBAMfPIwTHe/ZFheiJLdb/e6wAAAAAAQwAAA==" Mailbox="user#domain.demo"/>
<AlternateId Format="EntryId" Id="AAAAAF6BdU8APhVJsGWfKuqS58IHAMfPIwTHe/ZFheiJLdb/e6wAAAAAAQwAAEp86F7RqydMniCqPL+oKLEAAeNW8FMAAA==" Mailbox="user#domain.demo"/>
</m:SourceIds>
</m:ConvertId>
</soap:Body>
</soap:Envelope>
And the response is
<?xml version="1.0" encoding="ISO-8859-1"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" Version="V2018_01_08" MinorBuildNumber="31" MajorBuildNumber="1228" MinorVersion="20" MajorVersion="15"/>
</s:Header>
<s:Body>
<m:ConvertIdResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
<m:ResponseMessages>
<m:ConvertIdResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:AlternateId Mailbox="user#domain.demo" Id="AQMkAGU2ZWM5ZTQwLTk0MjMtNDY3NS1iZWI5LWQ4NTA0MDhmM2U0OQBGAAADXoF1TwA+FUmwZZ8q6pLnwgcAx88jBMd79kWF6Ikt1v97rAAAAgEMAAAASnzoXtGrJ0yeIKo8v6gosQAB41bwUwAAAA==" Format="EwsId" xsi:type="t:AlternateIdType"/>
</m:ConvertIdResponseMessage>
</m:ResponseMessages>
</m:ConvertIdResponse>
</s:Body>
</s:Envelope>
EDIT:
An example of two ids (two messages) request worling as expected.
Request:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header>
<t:RequestServerVersion Version="Exchange2010"/>
</soap:Header>
<soap:Body>
<ConvertId xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
DestinationFormat="EwsId">
<SourceIds>
<t:AlternateId Format="EntryId"
Id="AAAAAF6BdU8APhVJsGWfKuqS58IHAMfPIwTHe/ZFheiJLdb/e6wAAAAAAQwAAEp86F7RqydMniCqPL+oKLEAAiLXM0AAAA=="
Mailbox="user#domain.demo"/>
<t:AlternateId Mailbox="user#domain.demo"
Id="AAAAAF6BdU8APhVJsGWfKuqS58IHAMfPIwTHe/ZFheiJLdb/e6wAAAAAAQwAAEp86F7RqydMniCq PL+oKLEAAiC+eEMAAA=="
Format="EntryId"/>
</SourceIds>
</ConvertId>
Response:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="20" MajorBuildNumber="1273" MinorBuildNumber="26" Version="V2018_01_08" xmlns:h="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><m:ConvertIdResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:ConvertIdResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:AlternateId xsi:type="t:AlternateIdType" Format="EwsId" Id="AQMkAGU2ZWM5ZTQwLTk0MjMtNDY3NS1iZWI5LWQ4NTA0MDhmM2U0OQBGAAADXoF1TwA+FUmwZZ8q6pLnwgcAx88jBMd79kWF6Ikt1v97rAAAAgEMAAAASnzoXtGrJ0yeIKo8v6gosQACItczQAAAAA==" Mailbox="user#domain.demo"/>
</m:ConvertIdResponseMessage>
<m:ConvertIdResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:AlternateId xsi:type="t:AlternateIdType" Format="EwsId" Id="AQMkAGU2ZWM5ZTQwLTk0MjMtNDY3NS1iZWI5LWQ4NTA0MDhmM2U0OQBGAAADXoF1TwA+FUmwZZ8q6pLnwgcAx88jBMd79kWF6Ikt1v97rAAAAgEMAAAASnzoXtGrJ0yeIKo8v6gosQACIL54QwAAAA==" Mailbox="user#domain.demo"/>
</m:ConvertIdResponseMessage>
</m:ResponseMessages>
</m:ConvertIdResponse>
</s:Body>
</s:Envelope>
Corrections
So, consolidating our exchange so it can be seen as the answer to date.
As per the sanity testing of this method by myself and Dmitry Streblechenko (the OP). In leveraging this method, multiples are allowed.
For example: only one type (messages) or another (folders) is allowed at the same time.

How to retrieve all changed folders from the root public folder via EWS?

I need to get all public folders when a user changes permissions or items in a folder. How to do it? I can not find the proper answer in the documentation.
I only found this:
POST outlook.office365.com/EWS/Exchange.asmx
?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header>
<t:RequestServerVersion Version="Exchange2013" />
<t:ExchangeImpersonation>
<t:ConnectingSID>
<t:PrimarySmtpAddress>test#test_test.onmicrosoft.com</t:PrimarySmtpAddress>
</t:ConnectingSID>
</t:ExchangeImpersonation>
</soap:Header>
<soap:Body>
<m:SyncFolderHierarchy>
<m:FolderShape>
<t:BaseShape>IdOnly</t:BaseShape>
</m:FolderShape>
<m:SyncFolderId>
<t:DistinguishedFolderId Id="publicfoldersroot" />
</m:SyncFolderId>
</m:SyncFolderHierarchy>
</soap:Body>
</soap:Envelope>
and the response is:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="20" MajorBuildNumber="1207" MinorBuildNumber="28" Version="V2018_01_08" xmlns:h="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>
<m:SyncFolderHierarchyResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:SyncFolderHierarchyResponseMessage ResponseClass="Error">
<m:MessageText>The root of a folder hierarchy synchronization cannot be set to the id of a public folder. Use FindFolder to synchronize the public folder hierarchy.</m:MessageText>
<m:ResponseCode>ErrorInvalidOperation</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:SyncState/>
<m:IncludesLastFolderInRange>true</m:IncludesLastFolderInRange>
</m:SyncFolderHierarchyResponseMessage>
</m:ResponseMessages>
</m:SyncFolderHierarchyResponse>
</s:Body>
</s:Envelope>
As you can see it does not work.

How to properly create/update public folder via EWS using admin impersonation?

I cannot create any public folder in case when I set proper permission (through WebUI) to that user (in my case admin).
But when I try to update public folder`s 'EffectiveRights' to add permission level to that user I cannot do it. Which request I need to send to update user permission level on public folder or add proper 'EffectiveRights' on that public folder?
Example of the request:
POST outlook.office365.com/EWS/Exchange.asmx
Content-Type:text/xml; charset=utf-8
Accept:text/xml; charset=utf-8
BODY
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header>
<t:RequestServerVersion Version="Exchange2013_SP1" />
<t:ExchangeImpersonation>
<t:ConnectingSID>
<t:PrimarySmtpAddress>test#test_test.onmicrosoft.com</t:PrimarySmtpAddress>
</t:ConnectingSID>
</t:ExchangeImpersonation>
</soap:Header>
<soap:Body>
<UpdateFolder xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<FolderChanges>
<t:FolderChange>
<t:DistinguishedFolderId Id="publicfoldersroot" />
<t:Updates>
<t:SetFolderField>
<t:FieldURI FieldURI="folder:EffectiveRights"/>
<t:Folder>
<t:EffectiveRights>
<t:CreateAssociated>false</t:CreateAssociated>
<t:CreateContents>true</t:CreateContents>
<t:CreateHierarchy>false</t:CreateHierarchy>
<t:Delete>false</t:Delete>
<t:Modify>false</t:Modify>
<t:Read>true</t:Read>
</t:EffectiveRights>
</t:Folder>
</t:SetFolderField>
</t:Updates>
</t:FolderChange>
</FolderChanges>
</UpdateFolder>
</soap:Body>
</soap:Envelope>
and the response is:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="20" MajorBuildNumber="1164" MinorBuildNumber="25" Version="V2018_01_08" xmlns:h="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>
<m:UpdateFolderResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:UpdateFolderResponseMessage ResponseClass="Error">
<m:MessageText>Set action is invalid for property.</m:MessageText>
<m:ResponseCode>ErrorInvalidPropertySet</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:MessageXml>
<t:FieldURI FieldURI="folder:EffectiveRights"/>
</m:MessageXml>
<m:Folders/>
</m:UpdateFolderResponseMessage>
</m:ResponseMessages>
</m:UpdateFolderResponse>
</s:Body>
</s:Envelope>
another one example:
POST outlook.office365.com/EWS/Exchange.asmx
Content-Type:text/xml; charset=utf-8
Accept:text/xml; charset=utf-8
BODY
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2013_SP1" />
<t:ExchangeImpersonation>
<t:ConnectingSID>
<t:PrimarySmtpAddress>test#test_test.onmicrosoft.com</t:PrimarySmtpAddress>
</t:ConnectingSID>
</t:ExchangeImpersonation>
</soap:Header>
<soap:Body>
<m:UpdateFolder>
<m:FolderChanges>
<t:FolderChange>
<t:FolderId Id="AAEuAAAAAAAaRHOQqmYRzZvIAKoAL8RaAwCOXNGsJPKoS5iTrqfBNvbzAACDSr4rAAA=" />
<t:Updates>
<t:SetFolderField>
<t:FieldURI FieldURI="folder:PermissionSet" />
<t:Folder>
<t:PermissionSet>
<t:Permissions>
<t:Permission>
<t:UserId>
<t:PrimarySmtpAddress>test#test_test.onmicrosoft.com</t:PrimarySmtpAddress>
</t:UserId>
<t:PermissionLevel>Editor</t:PermissionLevel>
</t:Permission>
</t:Permissions>
</t:PermissionSet>
</t:Folder>
</t:SetFolderField>
</t:Updates>
</t:FolderChange>
</m:FolderChanges>
</m:UpdateFolder>
</soap:Body>
</soap:Envelope>
and the response:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="20" MajorBuildNumber="1143" MinorBuildNumber="18" Version="V2018_01_08" xmlns:h="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>
<m:UpdateFolderResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:UpdateFolderResponseMessage ResponseClass="Error">
<m:MessageText>Access is denied. Check credentials and try again., Underlying MAPI stream threw exception</m:MessageText>
<m:ResponseCode>ErrorAccessDenied</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:Folders/>
</m:UpdateFolderResponseMessage>
</m:ResponseMessages>
</m:UpdateFolderResponse>
</s:Body>
</s:Envelope>
Because your trying to create folders in publicfoldersroot no user has rights by default to do that (this is to stop people messing up the Public Folder root). So if you want your user test#test_test.onmicrosoft.com you would need to first grant them rights to do that on the Root folder either using the EAC or Add-PublicFolderclientPermissions. I would suggest you first create a folder in the Root using the EAC and then get your code to create child folders of that, from a development point of view this is easier to cleanup when you need to delete everything and test again then trying to clear the whole root hierarchy each time.
Also only you second example will work because EffectiveRights is a calculate property so can't be updated, all you can do is update the underlying DACL of the folder which is what you second request is doing

Resources