zarafa summercamp 2012 - exchange web services, technical information

26
Exchange Web Services (EWS) Steve Hardy

Upload: zarafa

Post on 17-Dec-2014

955 views

Category:

Technology


3 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

Exchange Web Services (EWS)Steve Hardy

Page 2: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

- 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>

Page 3: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

• 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?

Page 4: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

- 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

Page 5: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

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

Page 6: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

EWS authentication: moving into zarafa-ewsd

Zarafa-ewsd

Zarafa-server

LDAP

NTLM/Kerberos

Trusted connection

Page 7: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

• 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

Page 8: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

• Synchronization calls– SyncFolderHierarchy

– SyncFolderContents

• Used in synchronization clients– Works a lot like IMAP

– Gets incremental updates

Synchronize vs Live

Page 9: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

Synchronization

Old state

ChangesSync state A

SyncFolderContents()

Page 10: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

Synchronization

Old state

ChangesSync state B

Page 11: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

• Used for– Search

– Archiving

– Anything that doesn’t require replication of data

Live access

Page 12: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

• GetFolder()• GetItem()• FindFolder()• FindItem()

• MoveItem()• CopyItem()• DeleteItem()

Live access

Current store data

Page 13: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

• 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

Page 14: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

MIME vs MAPI

MIME MAPI

RFC822 contentSingle blob of data

FromTo

SubjectHeaders

DateBody

RecipientsAttachments

Page 15: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

• 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

Page 16: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

• EWS supports various notification models• Client can subscribe for events• Three modes

– Polling

– Push

– Pull

Notifications

Page 17: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

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

Page 18: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

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

Page 19: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

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

Page 20: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

• 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

Page 21: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

The socket solution

Main server

Forkedworker

request

Page 22: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

The socket solution

Main server

Forkedworker

reply

Page 23: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

The socket solution

Main server

Forkedworker

Waiting for notificationevent

Page 24: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

The socket solution

Main server

Forkedworker

Socket passed back toMain server, which handlesnotifications

Page 25: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

The socket solution

Main server

Main processReplies afterSome time

Page 26: Zarafa SummerCamp 2012 - Exchange Web Services, technical information

• 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