2. What is EWS
- XML-based protocol (SOAP)
- Introduced in Exchange 2007
- Successor to previous WebDAV approach
- Used from introduction for OWA 2007 and later
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope>
<soap:Body>
<GetItem>
<ItemShape>
<t:BaseShape>Default</t:BaseShape>
<t:IncludeMimeContent>true</t:IncludeMimeContent>
</ItemShape>
<ItemIds><t:ItemId Id="AAAlAF" ChangeKey="CQAAAB" /></ItemIds>
</GetItem>
</soap:Body>
</soap:Envelope>
3. Who/what is using EWS at the moment?
• Outlook 2010
– Free/Busy
– Some minor features
• Mac
– Outlook 2011
– ‘Mail’
– ‘Addressbook’
– ‘Calendar’
• Other
– Various opensource projects for accessing exchange server from
opensource packages (eg. Evolution, Thunderbird, etc)
– Various closed source projects (eg. Archivers, Indexers, etc)
4. EWS Authentication
- Uses HTTP authentication
- Digest
- Kerberos
- NTLM
- Entire connection authenticated
- All XML requests over a single HTTP connection are authenticated
as the same user
5. EWS authentication: problems
Authentication is done over multiple
levels
Zarafa-ewsd
•Username / Password authentication
always possible
•Unable to use NTLM authentication
build in zarafa-server Zarafa-server
– Per-store authentication (not per
connection)
•Same goes for kerberos LDAP
7. Protocol versions
• Exchange 2007
– Original version
• Exchange 2010
– Bulk transfer
– Conversations
– Exchange search
– Inbox rules
– Message tracking
– Unified messaging
– User configuration
• Also differences in service packs
– Message identifiers changes between RTM and SP1 of Exchange 2007
8. Synchronize vs Live
• Synchronization calls
– SyncFolderHierarchy
– SyncFolderContents
• Used in synchronization clients
– Works a lot like IMAP
– Gets incremental updates
9. Synchronization
Old state
Sync state A
Changes
SyncFolderContents()
11. Live access
• Used for
– Search
– Archiving
– Anything that doesn’t require replication of data
12. Live access
• GetFolder()
• GetItem()
• FindFolder()
• FindItem()
• MoveItem() Current store data
• CopyItem()
• DeleteItem()
13. MIME vs MAPI
• Many current EWS clients started out as IMAP client
• IMAP structure of clients is ‘synchronize’ pattern
– SyncFolderHierarchy() / SyncFolderContents()
• Actual email contents can be represented by
– MIME content
– MAPI content
• MIME content
– Same problem as for IMAP gateway, entire RFC822 message must be
stored
14. MIME vs MAPI
MIME MAPI
From
To
Subject
Headers
RFC822 content
Date
Single blob of data
Body
Recipients
Attachments
15. MIME vs MAPI
• Mac ‘Mail’
– MIME
• Outlook 2011
– MAPI
• MAPI preferred due to
– Overhead of converting to MIME (still needed in spite of RFC822
storage)
– Modifications are always in MAPI model (you cannot modify the MIME
data)
– Why re-parse the email when the server has already done it
– More efficient data access (possible to read separate attachments
instead of entire email only)
16. Notifications
• EWS supports various notification models
• Client can subscribe for events
• Three modes
– Polling
– Push
– Pull
17. Polling events
1. Subscribe (any change in inbox) -> Subscription ID
2. GetEvents(subscription id) -> 0 or more events
3. Sleep(60)
4. Goto 2
Pro: easy
Con: requires request every N seconds
Con: latency N seconds
18. Pull
1. Subscribe (any change in inbox) -> Subscription ID
2. GetEvents(subscription id, timeout 60s) -> 0 or more events
3. Goto 2
Pro: Only one call per, say, 10 minutes
Pro: Latency in the millisecond range
Con: Requires TCP open connection at all times
19. Push
1. Subscribe (any change in inbox, call me back at
http://server:port/url) -> Subscription ID
2. Wait for server to connect
Pro: No calls open to server
Con: server must be able to contact client
(only useful in server-to-server applications)
20. The socket problem
• With ‘pull’ notifications
– Each client has open socket
– Zarafa-ewsd is ‘forked’
– Normally this would mean 1 process per client
– 10000 users = 10000 process
– Bad for memory consumption and scalability
26. The wsdl file
• Wsdl file(s) define the SOAP structure
• We must present a wsdl that is compatible with exchange EWS
• We cannot ship the file from exchange directly due to copyright
• Generating our own may introduce subtle differences
• Unknown if clients actually read the file in practice