SimpleHTTP
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, 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
A 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 Hostnames in the Server 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 an 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.
In the disabled state (checkbox cleared), there will be an attribute 'CacheConnection' added to the element 'URL' in the input schema. If this 'CacheConnection' value is 'false' in input XML, the connection will not be stored in the cache.
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
This property appears only if the "Cleanup resources after each document" property is disabled.
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.
Monitoring configuration
Please refer to the Monitoring Configuration section in Common Configurations page.
Expert Properties
Please note that these attributes are meant for advanced users and hence use with caution.
Pre Processing XSL Configuration
Pre Processing XSL configuration can be used to transform request message before processing it. Click the ellipses button against the property to configure the properties.
Refer to the Pre/Post Processing XSL Configuration section under the Common Configurations page for details regarding Pre Processing XSL configuration and Post Processing XSL configuration (below).
Post Processing XSL Configuration
Post Processing XSL configuration can be used to transform response message before sending it to the output port.
Process Message Based on Property
The property helps components to skip certain messages from processing.
Refer to the Process Message Based On a Property section under the Common Configurations page.
Validate Input
Refer to the Validate Input section under the Common Configurations page.
Target Namespace
Refer to the Target Namespace section under the Common Configurations page.
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
The 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 a Feeder and a Display component to send sample input and check the response respectively.
Figure 10: Demonstrating Scenario 1 with sample input and output
Sample Input
<?xml version="1.0" encoding="UTF-8"?>
<ns1:HTTPRequest xmlns:ns1="http://www.fiorano.com/fesb/activity/SimpleHTTP1">
<URL>http://www.google.co.in/advanced_search?hl=en</URL>
</ns1:HTTPRequest>
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 the Feeder component to send sample input given below and Display component to display the output message.
Sample Input
<ns1:HTTPRequest xmlns:ns1="http://www.fiorano.com/fesb/activity/SimpleHTTP1">
<URL CacheConnection="true">http://localhost:9999/index.html</URL>
<Content>Sample Content</Content>
</ns1:HTTPRequest>
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.