HTTP handler

The HTTP handler is a Java component that consists of properties. The handler delivers an outbound integration message to a URL by using HTTP or HTTPS protocols. The HTTP handler also evaluates the response code received from the external system.

HTTPEXIT property

This optional property is used for customization and specifies the fully qualified name of a Java class that interprets the HTTP response. This property also helps implement the code that is required for an external system to interpret the HTTP response.

Tip: You also can configure HTTP handler exits by using automation scripts. For more information about configuring with a script, see Defining an HTTP handler using a script.

The Java class must be available in the application EAR file and must be in the class path of the handler.

Table 1. Property values
Property Value
Java class DefaultHTTPExit.java
Package psdi.iface.router
HTTPEXIT property psdi.iface.router.DefaultHTTPExit

If you do not specify a value for this property, the DefaultHTTPExit exit class is executed and implements the psdi.iface.router.HTTPExit interface. The Java class has the following key methods:

Table 2. Key methods for the Java class
Method Signature Description
processResponseData() public void processResponseData(int responseCode, String responseMsg, byte[] msgBodyData) throws MXException

The default implementation compares the response code from the external system to a range of valid codes (values 200 through 299). If the response code falls outside that range, the system assumes that the message was not delivered to the external system. An exception occurs and the message remains in the queue.

If you need additional processing for a specific implementation, extend the default implementation and override the processResponseData () method. As an alternative, you can implement the psdi.iface.router.HTTPExit interface. If the response that is received from the external system does not pass the validation in this class, the overriding method must issue an exception.

If you do not define a value for this property, the default implementation of HTTPExit is run.

getURLProperties() public Map String, String getURLProperties(Map String,? metaData, byte[] data, Map String,MaxEndPointPropInfo httpInfo) Returns the map of URL properties that are added to the URL in the form url?prop1=value1&... The default implementation returns a null value.
getHeaderProperties() public Map String, String getHeaderProperties(Map String,? metaData, byte[] data, Map String,MaxEndPointPropInfo httpInfo) Returns a map of the HTTP header properties for the request. The default implementation returns a null value unless a header property map is associated with the metadata map that has the HEADERPROPS key.
transformPayloadToFormData() public Map String, String transformPayloadToFormData
(Map String,? metaData, byte[] data,Map String,MaxEndPointPropInfo destinationMap)
Converts the XML payload to data. The default implementation returns a null value.
You can use the following methods to control the exception if an error occurs. If you create a script that includes one of these methods, select the Allow invoking methods check box so that the script processor can invoke the script functions that map to these methods.
Table 3. Methods for exception customization
Method Description
urlProps() Adds query parameters to a configured URL. The psdi.iface.router.ScriptHTTPReq interface implements the request object.
getUrl() Sets the URL for the HTTP call.
headerProps() Sets the request headers for the HTTP call.
processResponse() Processes the HTTP response. The psdi.iface.router.ScriptHTTPResp interface implements the response object.

CONNECTTIMEOUT property

This optional property specifies the connection timeout value in milliseconds.

READTIMEOUT property

This optional property specifies the read timeout value in milliseconds.

HTTPMETHOD property

This required property specifies a valid HTTP method that is executed by the endpoint. Valid HTTP methods are GET, POST, PUT, PATCH, and DELETE.

HTTPHEADER property

This optional property can add a comma-separated list of names and values to the header section of HTTP messages. The list includes name and value information in the format of Headername1:Headervalue1, Headername2:Headervalue2. If no value is provided in the property, custom code can inject the values into the transaction context during invocation channel processing.

URL property

This optional property specifies a valid URL to which XML data can be posted or where an HTTP GET operation can be performed.

USERNAME and PASSWORD properties

If the URL requests basic authentication, these properties specify the required values. Both values are MIME encoded and are passed to the URL.