Using HTTP Adapters with Ensemble
About the Ensemble HTTP Adapters
[Back] [Next]
   
Server:docs1
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

The HTTP adapters (EnsLib.HTTP.InboundAdapter and EnsLib.HTTP.OutboundAdapter) enable your production to send and receive HTTP requests and responses. This chapter provides a brief introduction to these adapters.

Tip:
Ensemble also provides specialized business service classes that use these adapters, and one of those might be suitable for your needs. If so, no programming would be needed. See Connectivity Options in Introducing Ensemble.
HTTP Inbound Adapter and Helper Classes
The EnsLib.HTTP.InboundAdapter is the Ensemble HTTP listener for custom port listening, XML listening, and/or raw HTML handling. You use this adapter in cases when you prefer to listen on a private port rather than using a CSP page (which uses the standard web server to handle HTTP requests).
The class provides runtime settings that you use to specify items like the following:
The inbound HTTP adapter listens on the specified port, reads the input, and sends the input as a stream (either binary or character, depending on the character set in use) to the associated business service. The business service, which you create and configure, uses this stream and communicates with the rest of the production.
When you work with the HTTP inbound adapter, there are two helper classes that you might use: %Library.GlobalCharacterStream and %Library.GlobalBinaryStream. The inbound adapter sends a stream to the associated business service. Specifically, this is an instance of %Library.GlobalCharacterStream or %Library.GlobalBinaryStream, depending on the character set being used. In general, these classes provide methods that you can use to read the contents of the stream, get the length of the stream, read a single line, rewind, append data, and so on. Both of these basic classes are documented in the Caché documentation; for example, see the chapter Working with Streams in Using Caché Objects.
HTTP Outbound Adapter and Helper Classes
EnsLib.HTTP.OutboundAdapter is the Ensemble adapter for sending HTTP requests outside Ensemble and receiving HTTP responses. This adapter provides settings to control items such as the following:
The adapter provides methods for sending HTTP POST, GET, and PUT actions:
The adapter also provides properties and methods to manage cookies.
When you work with the HTTP outbound adapter, there are two helper classes that you can use: