Upload
zarafa
View
954
Download
3
Embed Size (px)
DESCRIPTION
Citation preview
Exchange Web Services (EWS)Steve Hardy
- XML-based protocol (SOAP)- Introduced in Exchange 2007- Successor to previous WebDAV approach- Used from introduction for OWA 2007 and later
What is EWS
<?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>
• 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)
Who/what is using EWS at the moment?
- Uses HTTP authentication- Digest
- Kerberos
- NTLM
- Entire connection authenticated- All XML requests over a single HTTP connection are authenticated
as the same user
EWS Authentication
Authentication is done over multiple levels
•Username / Password authentication always possible•Unable to use NTLM authentication build in zarafa-server
– Per-store authentication (not per connection)
•Same goes for kerberos
EWS authentication: problems
Zarafa-ewsd
Zarafa-server
LDAP
EWS authentication: moving into zarafa-ewsd
Zarafa-ewsd
Zarafa-server
LDAP
NTLM/Kerberos
Trusted connection
• 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
Protocol versions
• Synchronization calls– SyncFolderHierarchy
– SyncFolderContents
• Used in synchronization clients– Works a lot like IMAP
– Gets incremental updates
Synchronize vs Live
Synchronization
Old state
ChangesSync state A
SyncFolderContents()
Synchronization
Old state
ChangesSync state B
• Used for– Search
– Archiving
– Anything that doesn’t require replication of data
Live access
• GetFolder()• GetItem()• FindFolder()• FindItem()
• MoveItem()• CopyItem()• DeleteItem()
Live access
Current store data
• 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
MIME vs MAPI
MIME vs MAPI
MIME MAPI
RFC822 contentSingle blob of data
FromTo
SubjectHeaders
DateBody
RecipientsAttachments
• 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)
MIME vs MAPI
• EWS supports various notification models• Client can subscribe for events• Three modes
– Polling
– Push
– Pull
Notifications
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
Polling events
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
Pull
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)
Push
• 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
The socket problem
The socket solution
Main server
Forkedworker
request
The socket solution
Main server
Forkedworker
reply
The socket solution
Main server
Forkedworker
Waiting for notificationevent
The socket solution
Main server
Forkedworker
Socket passed back toMain server, which handlesnotifications
The socket solution
Main server
Main processReplies afterSome time
• 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
The wsdl file