Messaging API over HTTP protocol to establish context for data exchange

Technologies are provided for a protocol for retrieving data from a remote server at a local client and establishing a context for the client at the server. A client may execute an application enabling users to receive data such as emails stored at the server. The client may employ a messaging-over hypertext transfer protocol (HTTP) to request the data from the server. An HTTP POST request may incorporate specialized headers with instructions for data retrieval, and may enable the client to establish a context with the server to identify the client for subsequent data requests. After receipt of the POST request, the server may send a receipt response and chunked intermediary responses while the request is being processed. The server may also send a cookie to the client representing the context of the client, and the client may return the cookies with subsequent data requests to the server.

BACKGROUND

In a communications environment, a client/server relationship is often used to interconnect services that may be distributed across different remote locations. Often times a user may execute an application locally on the user's client device, and the application may retrieve data associated with the application from a remote server connected with the client device over a network. In an example scenario, after a connection is established between the client device and the server, the application may forward a request to the server, and the server may in turn send a request to a database to retrieve requested data and information. The server may return the retrieved data to the client device which may display the information to the user and enable the user to interact with the data.

A remote procedure call (RPC) protocol may sometimes be used to forward a request from a local client to a remote server to retrieve requested data. The RPC protocol, however, may involve some complex coding, and may require specialized configurations on the server side for enabling a successful RPC protocol for data retrieval. Additionally, some servers may become overloaded when a large quantity of users employ the RPC for accessing data, due to multiple redundancy of the RPC protocol. When servers become overloaded, users can lose established connections and may be unable to reconnect, which may reduce an overall quality of experience for user, and may prevent the user from accessing data through the client application. Furthermore, when a user is able to reconnect, the user may have to re-authenticate themselves with the server, because a context between the server and the client may only be active as long as a specific connection is alive. If the connection is lost due to a dropped connection, going out of range, switching to a new connection, or going into hibernation, for example, the user may have to re-establish a context with the server each time the client reconnects.

SUMMARY

Embodiments are directed to a protocol for retrieving data from a remote server at a local client and establishing a context for the client at the server. A client, such as a productivity or communications application, may enable users to receive data such as emails stored at the remote server on a user's local device. The client may incorporate specialized headers with established hypertext transfer protocol (HTTP) language such as an HTTP POST request in order to retrieve data. The headers may include instructions for data retrieval, and may also enable the client to establish a context with the server to identify the client for subsequent data requests. After receipt of the POST or similar request, the server may send a receipt response and chunked intermediary responses while the request is being processed. Additionally, after receipt of the POST or similar request, the server may generate a cookie representing a context of the client. The server may provide the cookie to the client in the intermediary responses and the client may save the cookie for future data requests. The client may return the cookies with subsequent data requests to the server for validation of the context and that the client is the same authenticated client.

DETAILED DESCRIPTION

As briefly described above, a system is described for providing a protocol for retrieving data from a remote server at a local client and establishing a context for the client at the server. A client may employ established hypertext transfer protocol (HTTP) language such as an HTTP POST request to retrieve data at the client form the server. The HTTP POST request may include headers with instructions for data retrieval, and may enable the client to establish a context with the server to identify the client for subsequent data requests. Upon receiving a data request, the server may generate a cookie representing a context of the client. The server may provide the cookie to the client with chunked intermediary responses, and the client may return the cookies with subsequent data requests to the server.

While the embodiments will be described in the general context of program modules that execute in conjunction with an application program that runs on an operating system on a computing device, those skilled in the art will recognize that aspects may also be implemented in combination with other program modules.

Throughout this specification, the term “platform” may be a combination of software and hardware components for providing a messaging-over-HTTP protocol to establish a context between a client and a server and to exchange data over a network. Examples of platforms include, but are not limited to, a hosted service executed over a plurality of servers, an application executed on a single computing device, and comparable systems. The term “server” generally refers to a computing device executing one or more software programs typically in a networked environment. However, a server may also be implemented as a virtual server (software programs) executed on one or more computing devices viewed as a server on the network. More detail on these technologies and example operations is provided below.

FIG. 1illustrates an example environment where a client may access productivity and communication services over a network, according to some embodiments herein. The computing devices and computing environments shown in diagram100are for illustration purposes. Embodiments may be implemented in various local, networked, and similar computing environments employing a variety of computing devices and systems.

As illustrated in diagram100, a user may employ a variety of different client devices to execute applications for exchanging and interacting with data. Example applications executed at a user's client device for interacting with data may be a productivity service106and a communication service104.

An example productivity service106may be configured to provide access to various services built around a productivity platform. Some productivity services may include an email application, a social networking application, a collaboration application, an enterprise management application, a messaging application, a word processing application, a spreadsheet application, a database application and a presentation application. The productivity service106may provide access to data associated with the various productivity applications by retrieving the data from a remote server110. The remote server110may be accessed over a network112, which may be a wired or wireless network, or a cloud network, and the retrieved data may be loaded at a user's local client device executing the productivity service106.

Similarly, an example communication service104may be a service configured to provide email, contacts management, and calendar services. The communication service104may also provide real-time communications platforms, such as instant messaging, audio/visual conferencing, and presence detection. For example, a user may receive, view and reply to emails at the communication service104executed on the user's client device. Some example client devices for viewing emails and accessing other communications data may include as a desktop computing device, a personal computer, a tablet, a smartphone, a whiteboard and other similar client devices. The communication service and the productivity service may also work in conjunction to retrieve and exchange email and other data.

The services provided by the communication service104and the productivity service106may be hosted at an external server associated with the communication service104and the productivity service106, and a user may access the provided services locally at a user's client device over the network112. Additionally, data may be exchanged between the local client device and the server over the network112, such that the local client device may need to have an active connection with the server110over the network in order to access and interact with data provided by the communication service104and the productivity service106.

The local client, such as the communication service104or the productivity service106may issue a number of requests to the server110to retrieve data. Each time the local client requests data from the server110, the client may have to authenticate itself with the server. Additionally, if the connection between the client and the server110is dropped or changed during the data request and exchange, the client may have to re-authenticate itself with the server to re-establish the connection for data exchange. In a system according to embodiments, a context may be established between the client and the server110during an initial data request, and the context may be used as a basis of authentication for subsequent data retrieval requests.

The term “context” is used herein to represent a collection of state on the server that is held between unique client requests and is referenced using a cookie returned when the “context” was created and on each subsequent response. The collection of state information may be uniquely specific to server implementation and not specifically identified or defined within the protocol itself as it is never transmitted across the wire. The collection of state may also be not tied to any physical or logical connection from the client to the server. A client may be free to issue subsequent requests to the server identifying the “context” via a cookie on any newly established connections independent of the connection in which the “context” was initially created.

FIG. 2illustrates an example data exchange between a client and a server employing messaging-over-HTTP protocol, according to some embodiments herein.

As illustrated in diagram200, a client202may execute a productivity application or a communication application204, such as an email, contacts and calendar management application, on a local device. The client202may communicate with a server208over a network to retrieve data associated with the communication application204such as email data.

In a system according to embodiments, a connection may be established between the client202and the server208in order to enable data to be exchanged with the communication application204. The client202may initiate a connection with the server208, and may request data from the server208. The server208may accept the request, process the request, and return the requested information to the client202. During the initial request, a context210may be established between the client202and the server208to authenticate the client202for subsequent data retrieval requests.

In an example embodiment, HTTP may be employed for to facilitate communication, authentication, and exchange of data between the client and the server208. Established HTTP language may define methods, or verbs, which may indicate the desired action to be performed by the server to retrieve requested information. For example, a verb may include a GET verb which may be a request to retrieve data. Another example verb employed in HTTP may be a POST verb which may be an action to request that the server accept data enclosed in the HTTP request as a new data to be added to data at the server.

In an example embodiment, the client202may incorporate a messaging protocol over established HTTP requests in order to facilitate retrieving data associated with the communication application executed at the client from the server208. The messaging-over-HTTP protocol206may enable the client202to send a request to the server208over an HTTP connection and to receive a server response over the same HTTP connection. The messaging-over-HTTP protocol206may also enable the client202to establish a context with the server208over the HTTP connection for authenticating the client during future requests. Furthermore, the client202may open additional HTTP connections with the server208to send concurrent independent requests to the server208.

In an example embodiment, the client202request may incorporate data request language with traditional HTTP POST request language to generate the messaging-over-HTTP protocol. The messaging-over-HTTP protocol may include a specialized header structure for instructing the server with what data to retrieve and how to respond to the client. The specialized header structure may include a request type header, a request identification header, a mailbox identification header and a content-type header. A request type header may be an X-RequestType header which may be employed to tell the server208what operation the client202is attempting to perform. For example, a connect request may be a request to access and retrieve data from a mailbox associated with an email account. A bind request may be a request to access and retrieve data from an address book associated with a contacts management application.

Additionally, the request identification header may be an X-RequestID header which may identify the client202to the server208. The server208may not accept un-identified or anonymous requests. Additionally, the mailbox identification header may be a MailboxID parameter that uniquely identifies an email account or mailbox associated with the client from which the server208is requested to retrieve email data. Further the POST request may include a content type header, which may be a Content-Type header set to “application/mapi-http.” The headers discussed herein are examples for illustration purposes and are not intended to be limitations on embodiments.

An example messaging-over-HTTP protocol request may be as follows:

An example messaging-over-HTTP protocol request employing a bind request may be as follows

An example messaging-over-HTTP protocol request employing a connect request may be as follows:

FIG. 3illustrates example data requests and responses exchanged between a client and a server to establish a context employing messaging-over-HTTP protocol, according to some example embodiments.

As previously described in conjunction withFIG. 2, a client302may utilize a standardized HTTP POST request in order to request data from a server304associated with an application executed at the client302. The specialized data request language may be incorporated with the HTTP POST language to produce a messaging-over-HTTP protocol configured to instruct the server304what data to retrieve, where to retrieve it from, and how to respond to the client302. The messaging-over-HTTP protocol may also be configured to establish a context between the client302and the server304to authenticate the client302to the server for future data requests.

As illustrated in diagram300, after the server receives an initial POST request306, a series of responses may be returned to the client from the server. The initial POST request306may include instructions for the server304to respond to the initial POST request306with a receipt response308while the POST request306is being queued and processed by the server304. The receipt response308may provide the client302with an acknowledgement that the server304has received the request in order to prevent the client302from being unaware of a dropped connection or unavailability of the server304to process a request. If the client302does not receive the receipt response308within a reasonable period of time, then the client302may abandon and/or retry the POST request306.

In an example embodiment, the server304may also return intermediary chunk responses310while the server304processes the POST request306. A chunked response310from the server may include a Transfer-Encoding header with “chunked” as the transfer encoding. The chunked transfer encoding value may enable the server304to return intermediary responses and data to the client302while the POST request306is being processed by the server. The intermediary chunk responses310may provide a status of the request to the client302to indicate that the connection between the client302and server304has not been disconnected, and the server304is currently processing the POST request306. If the client302does not receive an expected intermediary response within a reasonable period of time, then the client302may abandon and/or retry the POST request306. An expected period of time for delivering intermediary responses may be defined by the client or the server, and may also be a configurable setting. The intermediary chunk responses310may also serve to keep the underlying HTTP connection active while the server304processes the POST request306.

In a system according to embodiments, the server304may also generate a cookie320to identify the client302and to establish a context of the client302with the server304. The server304may return the cookie320to the client302with the receipt response and with intermediary chunk responses in order to establish the context between the client302and the server304. The server304may define the cookie name and value according to server policies.

An example response from the server304to the client302including the generated cookie may be as follows:

Upon receiving the cookie320, the client302may store the cookie320for future interactions with the server304. When the client sends subsequent data requests to the server304employing the messaging-over-HTTP protocol, the client302may include the cookie320in the subsequent request322.

An example subsequent messaging-over-HTTP protocol data request including the received cookie may be as follows:

In an example embodiment, since the client302stores the cookie320and returns the cookie320during subsequent requests, the client302may not have to re-authenticate itself with the server304during each subsequent data request. The client302may provide the cookie320to the server304, and the server may automatically validate that the context represented by the cookie is from the same authenticated client. The server304may return the requested data to the authenticated client302in a final response.

In a system according to embodiments, the cookie may enable the context between the client and the server to be preserved in the event of a lost connection. For example, an HTTP connection may be lost when the client goes out of range, disconnects, changes connections, or goes into a hibernation mode. The client may still maintain the cookie320during the disconnection, and upon reconnection, the client302may provide the cookie320to the server304when the client302initiates a data request. The server304may be configured to store the context associated with the cookie320for a period of time, such that the client302may have some time to re-establish the connection with the server304before the context expires. After the defined period of time, the context may expire, and the client302may have to authenticate itself at the server304during a data request. A new cookie may be generated by the server and exchanged with the client to establish a new context.

In an example embodiment, the period of time for preserving the context may be predefined, and may also be configurable based on a network type, a client type, client devices associated with user, security parameters, and other similar parameters. The period of time for preserving the context may also be dynamic based on available resources at the server. For example, if only one client is interacting with the server304, the server may preserve the context for a longer period of time because the client is not consuming a lot of server resources. If there are multiple users or clients interacting with the server304, the server304may limit the number of preserved contexts and the time for preserving the contexts to preserver server resources. The server304may also communicate with the client302to tell the client302when the context will be expired. The client302may be able to refresh the established context to prolong a period of time of preservation for the context by communicating with server. For example, each time the client302actively communicates with the server304, the server304may refresh the expiration time of the context. After a context is expired, the context may be permanently discarded at the server304.

The example systems inFIG. 1 through 3have been described with specific configurations, applications, and interactions. Embodiments are not limited to systems according to these examples. A system for providing a messaging-over-HTTP protocol to establish a context between a client and a server and to exchange data over a network may be implemented in configurations employing fewer or additional components and performing other tasks. Furthermore, specific protocols and/or interfaces may be implemented in a similar manner using the principles described herein.

FIG. 4is an example networked environment, where embodiments may be implemented. A system for providing a messaging-over-HTTP protocol to establish a context between a client and a server and to exchange data over a network may be implemented via software executed over one or more servers414such as a hosted service. The platform may communicate with client applications on individual computing devices such as a smart phone413, a laptop computer412, or desktop computer411(‘client devices’) through network(s)410.

Client applications executed on any of the client devices411-413may facilitate communications via application(s) executed by servers414, or on individual server416. An application executed on one of the servers may facilitate communication as part of a productivity service, for example. The application may retrieve relevant data from data store(s)419directly or through database server418, and provide requested services (e.g. document editing) to the user(s) through client devices411-413.

Network(s)410may comprise any topology of servers, clients, Internet service providers, and communication media. A system according to embodiments may have a static or dynamic topology. Network(s)410may include secure networks such as an enterprise network, an unsecure network such as a wireless open network, or the Internet. Network(s)410may also coordinate communication over other networks such as Public Switched Telephone Network (PSTN) or cellular networks. Furthermore, network(s)410may include short range wireless networks such as Bluetooth or similar ones. Network(s)410provide communication between the nodes described herein. By way of example, and not limitation, network(s)410may include wireless media such as acoustic, RF, infrared and other wireless media.

Many other configurations of computing devices, applications, data sources, and data distribution systems may be employed to implement a platform for providing a messaging-over-HTTP protocol for data exchange between a client and a server over a network. Furthermore, the networked environments discussed inFIG. 4are for illustration purposes only. Embodiments are not limited to the example applications, modules, or processes.

FIG. 5and the associated discussion are intended to provide a brief, general description of a suitable computing environment in which embodiments may be implemented. With reference toFIG. 5, a block diagram of an example computing operating environment for an application according to embodiments is illustrated, such as computing device500. In a basic configuration, computing device500may be any computing device executing an application for providing a messaging-over-HTTP protocol for data exchange between a client and a server over a network according to embodiments and include at least one processing unit502and system memory504. Computing device500may also include a plurality of processing units that cooperate in executing programs. Depending on the exact configuration and type of computing device, the system memory504may be volatile (such as RAM), non-volatile (such as ROM, flash memory, etc.) or some combination of the two. System memory504typically includes an operating system505suitable for controlling the operation of the platform, such as the WINDOWS® operating systems from MICROSOFT CORPORATION of Redmond, Wash. The system memory504may also include one or more software applications such as a productivity service application522and a context module524.

The productivity application522may be an application offering a variety of services such as an email application, a social networking application, a collaboration application, an enterprise management application, a messaging application, a word processing application, a spreadsheet application, a database application and a presentation application. The productivity application522may be hosted at a remote server and may provide the services to a local client over a network. A context module524as part of the productivity application522may enable a client to establish a context with the server in order to enable the user to access and interact with data stored at a remote server, such as email, contacts and calendar data. The client may request data from the remote server employing a messaging-over-HTTP protocol which may provide instructions to the remote server for what data to retrieve and where to retrieve the data from, and may also instruct the remote server to send a receipt response and a series of chunk responses indicating a status of the processing of the request. Through the context module524, the server may establish a context and may provide a cookie representing the context to the client. Productivity application522and context module524may be separate applications or integrated modules of a hosted service. This basic configuration is illustrated inFIG. 5by those components within dashed line508.

Computing device500may have additional features or functionality. For example, the computing device500may also include additional data storage devices (removable and/or non-removable) such as, for example, magnetic disks, optical disks, or tape. Such additional storage is illustrated inFIG. 5by removable storage509and non-removable storage510. Computer readable storage media may include volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information, such as computer readable instructions, data structures, program modules, or other data. System memory504, removable storage509and non-removable storage510are all examples of computer readable storage media. Computer readable storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by computing device500. Any such computer readable storage media may be part of computing device500. Computing device500may also have input device(s)512such as keyboard, mouse, pen, voice input device, touch input device, and comparable input devices. Output device(s)514such as a display, speakers, printer, and other types of output devices may also be included. These devices are well known in the art and need not be discussed at length here.

Computing device500may also contain communication connections516that allow the device to communicate with other devices518, such as over a wired or wireless network in a distributed computing environment, a satellite link, a cellular link, a short range network, and comparable mechanisms. Other devices518may include computer device(s) that execute communication applications, web servers, and comparable devices. Communication connection(s)516is one example of communication media. Communication media can include therein computer readable instructions, data structures, program modules, or other data. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, RF, infrared and other wireless media.

FIG. 6illustrates a logic flow diagram for process600of providing a messaging-over-HTTP protocol to establish a context between a client and a server and to exchange data over a network, according to embodiments. Process600may be implemented on a computing device or similar electronic device capable of executing instructions through a processor.

Process600begins with operation610, where a connection may be established between a client and server. A client may be a productivity service and/or a communication service accessing information and data from a remote server over a network, such as a cloud network. At operation620, the server may receive a POST request from the client to initiate data retrieval at the server. The POST request may be a messaging-over-HTTP protocol which may include specialized headers with instructions for the data retrieval, including a request type header, a request identification header, a mailbox identification header and a content-type header. Operation620may be followed by operation630where the server may send a receipt response to the client upon receiving the POST request.

At operation640, the server may generate a cookie representing a context between the client and the server. The context may identify the client at the server during subsequent data requests. At operation650, the server may send intermediary chunk responses including the generated cookie to the client while the server processes the request. The intermediary chunk responses may indicate a status of the data request to the client. The cookie may be saved at the client, and may be maintained during dropped and transferred connections, and during hibernation of the client. At operation660, the server may receive subsequent POST requests from the client including the cookie, and the server may automatically validate the context as being from the same authenticated client.

The operations included in process600are for illustration purposes. Providing a messaging-over-HTTP protocol to establish a context between a client and a server and to exchange data over a network may be implemented by similar processes with fewer or additional steps, as well as in different order of operations using the principles described herein.