Zarafa SummerCamp 2012 - Exchange Web Services, technical information


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Zarafa SummerCamp 2012 - Exchange Web Services, technical information

  1. 1. Exchange Web Services (EWS)Steve Hardy
  2. 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. 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. 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. 5. EWS authentication: problemsAuthentication is done over multiplelevels Zarafa-ewsd•Username / Password authenticationalways possible•Unable to use NTLM authenticationbuild in zarafa-server Zarafa-server – Per-store authentication (not per connection)•Same goes for kerberos LDAP
  6. 6. EWS authentication: moving into zarafa-ewsd Zarafa-ewsd NTLM/Kerberos Trusted connection Zarafa-server LDAP
  7. 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. 8. Synchronize vs Live• Synchronization calls – SyncFolderHierarchy – SyncFolderContents• Used in synchronization clients – Works a lot like IMAP – Gets incremental updates
  9. 9. Synchronization Old state Sync state A Changes SyncFolderContents()
  10. 10. Synchronization Old state Changes Sync state B
  11. 11. Live access• Used for – Search – Archiving – Anything that doesn’t require replication of data
  12. 12. Live access• GetFolder()• GetItem()• FindFolder()• FindItem()• MoveItem() Current store data• CopyItem()• DeleteItem()
  13. 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. 14. MIME vs MAPIMIME MAPI From To Subject Headers RFC822 content Date Single blob of data Body Recipients Attachments
  15. 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. 16. Notifications• EWS supports various notification models• Client can subscribe for events• Three modes – Polling – Push – Pull
  17. 17. Polling events1. Subscribe (any change in inbox) -> Subscription ID2. GetEvents(subscription id) -> 0 or more events3. Sleep(60)4. Goto 2Pro: easyCon: requires request every N secondsCon: latency N seconds
  18. 18. Pull1. Subscribe (any change in inbox) -> Subscription ID2. GetEvents(subscription id, timeout 60s) -> 0 or more events3. Goto 2Pro: Only one call per, say, 10 minutesPro: Latency in the millisecond rangeCon: Requires TCP open connection at all times
  19. 19. Push1. Subscribe (any change in inbox, call me back at http://server:port/url) -> Subscription ID2. Wait for server to connectPro: No calls open to serverCon: server must be able to contact client(only useful in server-to-server applications)
  20. 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
  21. 21. The socket solution request Main Forked server worker
  22. 22. The socket solution reply Main Forked server worker
  23. 23. The socket solution Main Forked server worker Waiting for notification event
  24. 24. The socket solution Main Forked server worker Socket passed back to Main server, which handles notifications
  25. 25. The socket solution Main server Main process Replies after Some time
  26. 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