A LANSA Composer Processing Sequence can act as HTTP client, sending HTTP requests and payloads to an HTTP server and receiving the responses.
To implement this functionality in your own Processing Sequences, the main steps are:
Simple HTTP Outbound Activities
Advanced HTTP Outbound Activities
Simple HTTP Outbound Activities
LANSA Composer provides two activities that allow you to send a request with an optional payload to an HTTP server and receive a response, all in one operation. They are:
|
The supplied example Processing Sequence EXAMPLE_HTTPGET1 demonstrates the use of the HTTP_SIMPLE_GET activity to retrieve a file from an HTTP server.
(Refer to Example Processing Sequences for information on installing and using the example Processing Sequences. Refer to the notes supplied with Processing Sequence EXAMPLE_HTTPGET1 for instructions for its use.)
For many simple cases, these activities are the quickest and easiest to implement. Using these activities you can send a GET or POST (or other methods) with an optional single file as payload and receive a status or file in response.
However, for more advanced functionality, such as sending or receiving name-value pairs, multipart data and more, then you need to use the Advanced HTTP Outbound Activities instead.
Advanced HTTP Outbound Activities
LANSA Composer provides a set of advanced HTTP activities that provide maximum flexibility to prepare and send an HTTP request and receive and process the response. Using these activities it is possible to perform HTTP request processing well beyond the capabilities of the Simple HTTP Outbound Activities.
When implementing an outbound HTTP solution using these activities, you will always "bracket" the HTTP processing with these activities:
|
The HTTP_BEGIN_OUTBOUND activity specifies the HTTP Configuration that contains the details of how to connect to the required HTTP server. The HTTP_END activity indicates that the HTTP request processing is complete and associated resources may be freed.
In between those activities you will include one or more other of the HTTP advanced activities that apply to outbound requests. Which activities you use will depend on the specific requirements – for example, whether you wish to send (and receive) a file, name-value pairs or multipart formats and whether you need to set HTTP header properties.
You may use one or more of the following activities to prepare and send the outbound request:
|
After successfully sending the HTTP request, you may use one or more of the following activities to receive the HTTP response:
|
If you wish to send further HTTP requests you should use the following activity before preparing and sending the next request:
|
The supplied example Processing Sequence EXAMPLE_HTTPGET2 demonstrates the use of HTTP_BEGIN_OUTBOUND and other advanced HTTP activities to retrieve a file from an HTTP server.
(Refer to Example Processing Sequences for information on installing and using the example Processing Sequences. Refer to the notes supplied with Processing Sequence EXAMPLE_HTTPGET2 for instructions for its use.)