The framework for supporting HTTP clients in ATL Server applications consists of a client class ( CAtlHttpClientT ) and a set of feature classes that encapsulate different aspects of the behavior of the client class. The CAtlHttpClientT class is defined as follows :
template <class TSocketClass> class CAtlHttpClientT;
The template parameter is the class to be used for socket communications. ATL Server provides a single class to be used as a socket class ( ZEvtSyncSocket ). Therefore, it also provides a typedef for the HTTP client using this socket class:
typedef CAtlHttpClientT<ZEvtSyncSocket> CAtlHttpClient;
Note | The ZEvtSyncSocket class is an internal class and it s not supported by the MSDN documentation. It s strongly recommended that you not use this class directly. The supported (and recommended) way of using CAtlHttpClientT is to either use the default template instantiation (i.e., CAtlHttpClient , the typedef -ed version) or instantiate the template with your own socket class. Avoid explicitly instantiating the template with the ZEvtSyncSocket class or using this class directly in your applications. It may be dropped or replaced in later versions of ATL Server. |
For most of this chapter, you ll deal with the typedef -ed version of HTTP client, CAtlHttpClient . The main functionality of the HTTP client class is the Navigate method, which sends an HTTP request and collects the response from the server.
An HTTP request is defined by multiple elements: the destination, the content of the request, and the method of sending the content (HTTP verb) being the most important. You ll see in the following section how you can populate these request components using ATL Server classes.