HTTP Outbound (Client) Processing in LANSA Composer

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:

HTTP Configuration Details.

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:

HTTP_SIMPLE_GET

Retrieves a document from an HTTP server.

HTTP_SIMPLE_POST

Sends data to an HTTP server and/or receives response data from the server.

 

 

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:

HTTP_BEGIN_OUTBOUND

Begin HTTP outbound request handling

HTTP_END

End HTTP request processing

 

 

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:

HTTP_MULTIPART_SET

Set outbound multipart component item

HTTP_PROPERTY_SET

Set HTTP protocol property value(s)

HTTP_SEND

Send request to HTTP server

HTTP_SEND_FILE

Send file to HTTP server

HTTP_SEND_MULTI

Send multipart content to HTTP server

HTTP_SEND_NAMEVAL

Send name-value pairs to HTTP server

 

 

After successfully sending the HTTP request, you may use one or more of the following activities to receive the HTTP response:

HTTP_MULTIPART_GET

Get inbound multipart component item

HTTP_PROPERTY_GET

Get HTTP protocol property value(s)

HTTP_RECEIVE_FILE

Receive a single file HTTP payload

HTTP_RECEIVE_MULTI

Receive HTTP payload as multipart content

HTTP_RECEIVE_NAMEVAL

Receive HTTP payload as name-value pairs

 

 

If you wish to send further HTTP requests you should use the following activity before preparing and sending the next request:

HTTP_RESET

Reset for further HTTP outbound requests

 

 

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.)