Show TOC Start of Content Area

Background documentation HTTP Client  Locate the document in its SAP Library structure

Architecture

The HTTP client provides server-side HTTP requests, retrieving data from external sites and allows you to communicate with HTTP servers on the Internet.

This graphic is explained in the accompanying text

Architecture of the HTTP Client

The HTTP client implements parts of the HTTP 1.0 and HTTP 1.1 protocols, including:

      HTTP request methods HEAD, GET, POST, CONNECT, DELETE, OPTIONS, TRACE, PUT.

      WEBDAV extension methods COPY, LOCK, MKCOL, MOVE, PROPFIND, PROPPATCH, UNLOCK.

      Automatic handling of authorization, redirection requests, cookies, connection pooling. This is done by the HTTP connection manager.

Using the HTTP Client

User

As a user of the HTTP client implementation, you have to:

...

       1.      Instantiate the HTTPClient class.

       2.      Configure the properties for this instance of the HTTP client.

       3.      Connect to the HTTP client implementation and execute the methods you want.

       4.      Process the results form the request.

HTTP Client Implementation

The HTTP client implementation contains an HTTP methods processor, in which checks for authentication or redirections can be performed, and then a connection to the HTTP connection manager is started. The HTTP connection manager either opens a new connection or gets the connection from the HTTP connections pool, and connects to the HTTP server. Having received the resource, the HTTP method processor sends the response to the user.

Features

      Cookie management – allows the HTTP server to set cookies or to recall them when required. The method has a state and the cookies are held in that state. Using the API you can get this state.

      Connection pooling – allows multiple users to share a set of connection objects that provide access to a database resource. This is automatically performed by the connection manager in the HTTP connections pool.

      Custom methods – you can create and send custom HTTP methods as a request to the HTTP server.

      Stream request writing – uses the property output-stream-interceptor that enables the request body to be written directly into the stream. This is helpful if the request body is so big that your virtual machine may throw an exception that it cannot process the request, for example.

      Pluggable connection managers – you can add custom connection management algorithms, and in this way you can change the connection manager implementation with one of your own.

      Keep alive connection support – allows persistence connections. By default, the connection is always opened.

      Connection timeout support – you can set a timeout for getting a connection from the connection manager (using the properties connection-timeout) for setting the timeout to wait for opening a socket, and the connection-manager-timeout for setting the time for getting an HTTP connection from the connection manager.

      Request timeout support – you can use the socket-timeout property to set a request timeout that throws a timeout exception if there is no response.

      Idle connections timeout support – using the API you can set the timeout upon which all idle connections are automatically closed.

      Logging integrated – using the Logging API you can automatically log diagnostic and security information or use the interfaces provided for applications to log their own conditions.

      SSL support – Secure Socket Layer (SSL) protocol support, which allows Web browsers and servers to communicate over a secured connection.

      Basic authentication – support for the Basic authentication scheme that requires an instance of the UserPassCredentials object to be available. After setting a user name and a password in the object, the object is sent to the client.

      Digest authentication – support for the Digest authentication, which is more secure than the basic authentication. The support does not transfer the actual password across the network, but uses the password to encrypt a value sent from the HTTP server. The Digest authentication requires an instance of the UserPassCredentials object to be available. After setting a user name and a password in the object, the object is sent to the client.

      NTLM authentication – support of a proprietary protocol that uses the domain name of the realm. Clients can prove their identities without sending a password to the HTTP server.

      Proxy authentication – support for the Proxy authentication, which is similar to server authentication with the exception that the credentials for each proxy are stored independently.

      WEBDAV – support of Web-based Distributed Authoring and Versioning. This is a set of extensions to the HTTP protocol that allows users to collaboratively edit and manage files on remote Web servers.

See also:

·        There are many options you can configure for the HTTP client. See HTTP Client Properties.

·        Simple Get Request to a Specified Host and Port Example - makes a direct GET request to a specified host and port.

·        Get Request Using Proxy Example - makes a GET request trough specified proxy to a specified host and port.

·        Posting File Using Chunked Encoding Example - makes a direct chunked encoded POST of the specified file data to the specified URI.

·        Get Request Using Basic Authentication Example - performs a direct GET request using Basic authentication.

End of Content Area