HTTP and SOAP Channels : Using HTTP Functions to Configure HTTP Request Messages

Using HTTP Functions to Configure HTTP Request Messages
This section explains how HTTP functions are used to send secure and non-secure HTTP requests to other servers, and work with responses received.
See HTTP Channel Advanced Configuration Settings for details about setting up TIBCO BusinessEvents as a secure server.
Generating a Self-Signed SSL Certificate (Keystore)
HTTPS requires use of an SSL certificate. It creates a keystore file and password for the specified type of SSL certificate (keystore).
If you use trusted certificates, see Loading Trusted Certificates.
Signature
Object createKeystore(String ksFilePath, String ksType, String ksPassword)
Description
Creates and returns a keystore object, using the given parameters.
Parameters
 
Returns
 
Getting POST Data
Signature
Object getPostData(SimpleEvent event)
Description
Returns the POST data sent in an HTTP POST request (event).
Parameters
 
Request event sent on the HTTP destination. Must not be null.
Returns
 
Loading Trusted Certificates
As explained in Task A, Add an HTTP Connection, ensure that certificates from trusted certificate authorities are stored in the project, using an Identity resource in the TIBCO Shared Resources folder. Alternatively use the BE_GLOBAL_TRUSTED_CA_STORE global variable to store a location of the certificates outside of the project.
Signature
Object loadTrustedCertificates(String trustedCertsFolder, String passwordToSet)
Description
HTTPS requires use of an SSL certificate. This function loads a trusted certificate (that is, creates and returns a keystore object) from the trusted certificates folder.
Parameters
 
If trusted certificates are stored outside the project, use the following construct in the function:
System.getGlobalVariableAsString("BE_GLOBAL_TRUSTED_CA_STORE")
Returns
 
Sending an Event
To send an event as a request encapsulating request headers as properties.
Signature
Event sendRequest (String url, SimpleEvent requestEvent, String responseEventURI, long timeoutMillis)
Description
This function sends an event as a response to the request.
Parameters
 
The fully-qualified path of an event. This event is created when the response is received.
If the value is -1, the server waits forever.
Returns
 
Sending an Asynchronous Request (Not Secure)
To send requests to an HTTP server asynchronously, use this function.
Signature
String sendAsynchronousRequest(String url, SimpleEvent requestEvent, String correlationId, String callbackRuleFunctionURL, String methodType)
Description
Sends a request to the server specified by the url parameter. When TIBCO BusinessEvents receives a response, the callback function is called.
Returns a correlation ID, which is either passed as input, or is generated from the server if the parameter is null. This ID enables you to correlate a request with its response.
Parameters
 
The fully-qualified path of a rule function. This rule function is called when the response is received. The response event would contain the correlation ID.
The rule function must have correlation ID, RequestEvent, and ResponseEvent as parameters.
Returns
 
Sending a Secure Asynchronous Request
To send asynchronous requests using SSL, use this function.
Signature
String sendSecureAsynchronousRequest(String url, SimpleEvent requestEvent, String correlationID, String callbackRuleFunctionURL, String methodType, Object clientIdKeystore, String clientIdPassword, Object trustedCertsKeystore, String trustedCertsPassword boolean verifyHostName)
Description
This function is the same as the sendAsynchronousRequest() function, with the addition of the SSL-related parameters, shown below.
Parameters
All of the parameters for sendAsynchronousRequest() plus the following:
 
 
Flag for checking if a host name matches the names stored in the server’s certificates.
Returns
 
Sending a Secure Synchronous Request
To send synchronous requests using SSL, use this function.
Signature
Event sendSecureRequest(String url, SimpleEvent requestEvent, String responseEventURI, Object clientIdKeystore, String clientIdPassword, Object trustedCertsKeystore, String trustedCertsPassword, boolean verifyHostName,long timeoutMillis)
Description
This function is the same as the sendSecureAsynchronousRequest() function, except that the requests are synchronous. The parameters are shown below.
Parameters
 
The URL for the server that will receive this request.
The fully-qualified path of an event. This event is created when the response is received.
Flag for checking if a host name matches the names stored in the server’s certificates.
If the value is -1, the server waits forever.
Returns