Friday, March 25, 2011

Exchange 2007 Web services

Introduction
Recently, I had a chance to work on Exchange Web Services (EWS) API for 2007 version. Earlier, I had worked with Exchange 2003 and 2007 server for WebDAV protocol. As of my experience which I have had with Web Services and WebDAV API, Web Services is not an easy task since control is not in your hand. EWS provides a set of XML files through which you can prepare Java client for Exchange server communication. This Java client contains their own set of Java interfaces which needs to understand first for implementing your API. On other hand, WebDAV API controls easily by taking care of Exchange server properties.

About Exchange Server
Microsoft Exchange server is a server side of client-server model. This is a collaborative application product developed by Microsoft. Exchange's major features are mailing, calendaring, contacts and tasks. Exchange server supports for mobile and web based applications and it is treated as a database storage for collaborative items (Exchange server items).

About Exchange Web Services
Exchange Web Services is an interface which is used to communicate with Exchange server. This interface is exposed as SOAP (Simple object access protocol) based Web-service, which means requester must send his request in form of XML using SOAP to EWS contained in HTTP post request. EWS itself responds in the same manner using SOAP and XML messages in the HTTP response object. EWS is exposed on a Exchange Client Access Server (CAS) through an ASP.NET Web service. The basic flow of request/response is as follows,






For understanding the basics of Web services, please go through my one of post Web services basics.

Exchange 2007 Web-services
1) Exchange Web Services
2) Autodiscover Service
3) Unified Messaging Web Service

Exchange Web Services
Exchange Web Services provides the functionality to enable client applications to communicate with the Exchange server. Exchange Web Services provides access to much of the same data that is made available through Microsoft Office Outlook.

Exchange Web Services is described by three files:
1) Services.wsdl Describes the contract between client and server.
2) Messages.xsd Defines the request and response SOAP messages.
3) Types.xsd Defines the elements that are used in the SOAP messages.

These schema files are located in the EWS virtual directory of the computer that is running Exchange 2007 that has the Client Access server role installed.

Exchange Web Services provides the following types of operations:

1) Availability
2) Delegate Management (starting with Exchange 2007 Service Pack 1)
3) Folder
4) Item
5) Messaging Records Management
6) Notification
7) Synchronization
8) Utility

Autodiscover Service
The Autodiscover service provides a mechanism to automatically configure Exchange 2007 client applications to access the Client Access server. Autodiscover provides a powerful tool for configuring client application profiles used to discover Exchange Web Services and associated mailbox information. Autodiscover provides configuration information inside or outside of firewalls. In addition, Autodiscover will work in resource forest and multiple forest scenarios.

Unified Messaging Web Service
The Unified Messaging Web Service provides an extensibility point for clients to read and change information about Unified Messaging properties.

Why we use EWS?
As per me, I have worked with WebDAV supported API which supports till Exchange 2007 server. Beyond this versions, Exchange does not support for WebDAV. It supports only for EWS. This is my concern for using EWS.

There are some nice links for understanding EWS and its specifications in detail.

1) MSDN Getting Started With EWS : Introduction to Exchange 2007 Web Services.
2) EWS Operations : A list of the operations that can be performed on the EWS.
3) Glen Scales’ Blog : This guy knows Exchange inside and out.
4) EWS Basics : Basics of Exchange 2007 Web Services.
5) Programming With Exchange Server 2007 : Three part searies of EWS programming.
6) Rolf Woll's technical blog : Integrating Java with Exchange

Specifications implemented on EWS
1) HTTP
2) XML
3) Simple Object Access Protocol (SOAP)
4) Web Services Description Language (WSDL)

EWS Architechture
The following figure shows how a client application interacts with the Client Access server to access Exchange store information from the Mailbox server.


Applications that use Exchange Web Services can access data store items. The applications can access these items locally or remotely by using a SOAP version 1.1 or version 1.2 message. SOAP is an XML-based protocol that is defined in the World Wide Web Consortium (W3C). The SOAP messages are sent between client and server, embedded in an HTTP 1.1 message. The HTTP 1.1 protocol is defined by RFC 2616.

Exchange Web Services is deployed with the Client Access server role. Microsoft Exchange Server 2007 clients connect to the computer that is running Exchange 2007 that has the Client Access server role installed in an Active Directory directory service site by using an HTTPS connection.

EWS request and response flow
The following figure shows the steps involved in sending and receiving XML messages between the client application and the Exchange server.


When a client application requests information from the Exchange store, an XML request message that complies with the SOAP standard is created and sent to the Exchange server. When the Microsoft Exchange server receives the request, it verifies the credentials that are provided by the client and automatically parses the XML for the requested data. The server then builds a SOAP response that contains XML data that represents the requested strongly typed objects and their properties. The XML data is sent back to the client application in an HTTP response. The client application then de-serializes the XML and uses the data to reform the strongly typed objects.

No comments: