The Simple HTTP component enables the user to get content from an external HTTP server (web server). The component directly accepts the certificates. If the Content element is present in the input message, then Post method is used, else it uses Get method.
Configuration and Testing
The component can be configured using the Configuration Property Sheet (CPS).
Managed Connection Factory
This panel helps to configure Proxy settings.
Figure 1: Managed Connection Factory panel in SimpleHTTP CPS
Attributes
Proxy Settings
Please refer Proxy Settings section in Common Configurations page.
SSL Security
Use this property is SSL support is required.
Please refer SSL Security section in Common Configurations page.
Bypass proxy for hosts
Semi-colon separated list of hostnames/ IP Addresses for which the request must be sent without passing the proxy specified, if any. If no proxy is defined, this property is ignored.
Interaction Configurations
Figure 2: Interaction Configurations panel
Attributes
Accept Server Certificate
When accessing https URLs, this property determines whether the server certificates should be accepted or not.
- Enable this to accept server certificate without any validation.
- Disable it if server certificate should not be accepted. An exception is sent to ON_EXCEPTION port on such an event.
Ignore Hostname Mismatch
This property determines whether to accept the server certificate or not when Host names in the Sever Certificate matched with the one in the Request URL.
- Enable this to accept the certificate even if hostname in the Server Certificate does not match with the hostname in the Request URL.
- If disabled, when hostname in the certificate does not match with the hostname in the request URL, it generates exception.
Cleanup resources after each document
- Enable this property if the connection created for the request should be discarded after executing the request, without storing it in the cache.
Disable it to store the connection in a cache for further use without creating a new connection every time for the same URL.If disabled, 'Connection Cache Threshold' will be visible.
Connection Cache Threshold
This option specifies the threshold limit, that is the maximum number of connections that can be stored in the cache.
'-1' is the default value, which means connections are not removed from the cache. Any positive integer can be specified to limit the number of connections stored.
Figure 3: Connection Cache Threshold property
When you select a positive value for this property, another property 'Connection Removal Criteria' appears.
Connection Removal Criteria
Figure 4: Connection Removal Criteria
This option specifies the criteria to remove connections from the cache if the threshold limit exceeds.
- Least recently added: The oldest entry in the cache is removed
- Least recently accessed: The entry that has been in the cache for the longest time without being accessed.
Scheduler Configuration
Please refer Scheduler Configurations section in Common Configurations page.
Transport Configurations
Transport Configurations panel is used to configure messaging properties when the component is configured in Scheduling mode, that is, when you select the Enable Scheduling check box in the Scheduler Configuration panel,.
Please refer Transport Configurations section in Common Configurations page.
Error Handling
Please refer Error Handling section in Common Configurations page.
Testing
Connection can be Tested by clicking the Test button in the Managed Connection Factory panel.
Figure 5: Testing Connection configuration
Configuration can be tested by clicking Test button in the Interaction Configurations panel in the CPS.
Figure 6: Sample SimpleHTTP input message
Figure 7: Sample SimpleHTTP output message
Input Schema
Figure 8: Input Port Schema Structure
Schema Element | Description |
---|---|
<URL> | URL from which content has to be fetched. If we set "Cleanup resources after each document" property to "no", then the attribute "CacheConnection" appears in this element (as shown in Figure 4). This attribute accepts two values "true" and "false". If "true" is set to "CacheConnection" attribute, then the connections created are cached and these cached connections will be used when required. If we set "CacheConnection" attribute to "false", then the component clears the connection after each request. |
<Content> | Content to be posted (optional) |
Functional Demonstration
Scenario 1
This scenario demonstrates sending a simple HTTP request to a server.
Configure the SimpleHTTP as described below.
Figure 9: Sample configuration
Use feeder and display component to send sample input and check the response respectively.
Figure 10: Demonstrating Scenario 1 with sample input and output
Sample Input
Sample Output
Figure 11: HTML display of Output in Display Component
Scenario 2
The scenario demonstrates the way SimpleHTTP component can be used to post some data onto a web server hosted by an HTTPReceive component. The HTTPReceive Component is hosting on port 9999 on the localhost machine and is configured to receive post data as simple text and send it back to the client as simple text.
Figure 11: Demonstrates using SimpleHTTP component to post data
Configure the SimpleHTTP as in Figure 9. Use Feeder component to send sample input given below and Display component to display the output message.
Sample Input
Sample Output
Sample Content gets displayed.
Points to note
- For providing header properties like Content-Type or Content-Length, set the required properties in the input message with a prefix http_. Example http_Content-Type.
- For providing parameters, set the required properties in the input message as properties with a prefix param_. Example param_myproperty.
- To Post data we need to provide the header property Content-Type by setting property http_Content-Type to appropriate value on the input message. For example if we need to post simple text content then set the property http_Content-Type to text/plain.
- When connecting to secured sites, the component accesses truststore from different locations in different launch modes -
- Separate Process - %JAVA_HOME%\jre\lib\security\cacerts
- In-memory - %FIORANO_HOME%\esb\server\profiles\certs\jssecacerts
'jssecacerts' in %FIORANO_HOME% does not have trusted certificates required by most of the secured sites. Hence, to connect to secured sites, when component is launched in-memory, either the trusted certificates should be added to 'jssecacerts' or the property 'javax.net.ssl.trustStore' (in %FIORANO_HOME%\esb\server\bin\server.conf; if FPS is launched using server.bat/server.sh and %FIORANO_HOME%\esb\fps\bin\fps.conf, if FPS is launched using fps.bat/fps.sh) should be set to %JAVA_HOME%\jre\lib\security\cacerts.