HTTP Transformation Overview
HTTP Transformation Overview
Transformation type:
Passive
Connected
The HTTP transformation enables you to connect to an HTTP server to use its
services and applications. When you run a session with an HTTP transformation,
the Integration Service connects to the HTTP server and issues a request to
retrieve data from or update data on the HTTP server, depending on how you
configure the transformation:
Read data from an HTTP server. When the Integration Service reads data
from an HTTP server, it retrieves the data from the HTTP server and passes the
data to the target or a downstream transformation in the mapping. For example,
you can connect to an HTTP server to read current inventory data, perform
calculations on the data during the PowerCenter session, and pass the data to
the target.
Update data on the HTTP server. When the Integration Service writes to an
HTTP server, it posts data to the HTTP server and passes HTTP server
responses to the target or a downstream transformation in the mapping. For
example, you can post data providing scheduling information from upstream
transformations to the HTTP server during a session.
The following figure shows how the Integration Service processes an HTTP
transformation
The Integration Service passes data from upstream transformations or the
source to the HTTP transformation, reads a URL configured in the HTTP
transformation or application connection, and sends an HTTP request to the
HTTP server to either read or update data.
Requests contain header information and may contain body information. The
header contains information such as authentication parameters, commands to
activate programs or web services residing on the HTTP server, and other
information that applies to the entire HTTP request. The body contains the data
the Integration Service sends to the HTTP server.
When the Integration Service sends a request to read data, the HTTP server
sends back an HTTP response with the requested data. The Integration Service
sends the requested data to downstream transformations or the target.
When the Integration Service sends a request to update data, the HTTP server
writes the data it receives and sends back an HTTP response that the update
succeeded. The HTTP transformation considers response codes 200 and 202 as
a success. It considers all other response codes as failures. The session log
displays an error when an HTTP server passes a response code that is
considered a failure to the HTTP transformation. The Integration Service then
sends the HTTP response to downstream transformations or the target.
You can configure the HTTP transformation for the headers of HTTP responses.
HTTP response body data passes through the HTTPOUT output port.
Authentication
When you configure an HTTP transformation, you can configure the URL for the
connection. You can also create an HTTP connection object in the Workflow
Manager. Configure an HTTP application connection in the following
circumstances:
Table 8-1 describes the HTTP transformation properties that you can configure:
On the HTTP tab, you can configure the transformation to read data from the
HTTP server or write data to the HTTP server. Configure the following
information on the HTTP tab:
Select the method. Select GET, POST, or SIMPLE POST method based on
whether you want to read data from or write data to an HTTP server.
Configure groups and ports. Manage HTTP request/response body and
header details by configuring input and output ports. You can also configure port
names with special characters.
Configure a base URL. Configure the base URL for the HTTP server you want
to connect to.
Selecting a Method
The groups and ports you define in a transformation depend on the method you
select. To read data from an HTTP server, select the GET method. To write data
to an HTTP server, select the POST or SIMPLE POST method.
To define the metadata for the HTTP request, you must configure input and
output ports based on the method you select:
GET method. Use the input group to add input ports that the Designer uses to
construct the final URL for the HTTP server.
POST or SIMPLE POST method. Use the input group for the data that defines
the body of the HTTP request.
For all methods, use the header group for the HTTP request header information.
The ports you add to an HTTP transformation depend on the method you choose
and the group. An HTTP transformation uses the following groups:
Output. Contains body data for the HTTP response. Passes responses from the
HTTP server to downstream transformations or the target. By default, contains
one output port, HTTPOUT. You cannot add ports to the output group. You can
modify the precision for the HTTPOUT output port.
Input. Contains body data for the HTTP request. Also contains metadata the
Designer uses to construct the final URL to connect to the HTTP server. To
write data to an HTTP server, the input group passes body information to the
HTTP server. By default, contains one input port.
Header. Contains header data for the request and response. Passes header
information to the HTTP server when the Integration Service sends an HTTP
request. Ports you add to the header group pass data for HTTP headers. When
you add ports to the header group the Designer adds ports to the input and
output groups on the Ports tab. By default, contains no ports.
Note: The data that passes through an HTTP transformation must be of the
String datatype. String data includes any markup language common in HTTP
communication, such as HTML and XML.
Table 8-3 describes the groups and ports for the GET method:
Table 8-5 describes the ports for the SIMPLE POST method:
The Designer does not allow special characters, such as a dash (-), in port
names. If you need to use special characters in a port name, you can configure
an HTTP name to override the name of a port. For example, if you want an input
port named Content-type, you can name the port ContentType and enter
Content-Type as the HTTP name.
Configuring a URL
After you select a method and configure input and output ports, you must
configure a URL. Enter a base URL, and the Designer constructs the final URL. If
you select the GET method, the final URL contains the base URL and
parameters based on the port names in the input group. If you select the POST
or SIMPLE POST methods, the final URL is the same as the base URL.
You can use a mapping parameter or variable to configure the base URL. For
example, declare the mapping parameter $$ParamBaseURL, enter the mapping
parameter $$ParamBaseURL in the base URL field, and then define $
$ParamBaseURL in the parameter file.
You can also specify a URL when you configure an HTTP application connection.
The base URL specified in the HTTP application connection overrides the base
URL specified in the HTTP transformation.
Note: An HTTP server can redirect an HTTP request to another HTTP server.
When this occurs, the HTTP server sends a URL back to the Integration Service,
which then establishes a connection to the other HTTP server. The Integration
Service can establish a maximum of five additional connections.
The Designer constructs the final URL for the GET method based on the base
URL and port names in the input group. It appends HTTP arguments to the base
URL to construct the final URL in the form of an HTTP query string. A query
string consists of a question mark (?), followed by name/value pairs. The
Designer appends the question mark and the name/value pairs that correspond
to the names and values of the input ports you add to the input group.
When you select the GET method and add input ports to the input group, the
Designer appends the following group and port information to the base URL to
construct the final URL:
?<input group input port 1 name> = $<input group input port 1 value>
For each input port following the first input group input port, the Designer
appends the following group and port information:
& <input group input port n name> = $<input group input port n value>
For example, if you enter www.company.com for the base URL and add the input
ports ID, EmpName, and Department to the input group, the Designer constructs
the following final URL:
www.company.com?ID=$ID&EmpName=$EmpName&Department=$Department
You can edit the final URL to modify or add operators, variables, or other
arguments. For more information about HTTP requests and query string, see
http://www.w3c.org.
The Designer appends a question mark (?), the input group input port name, a
dollar sign ($), and the input group input port name again to the base URL to
construct the final URL:
http://www.informatica.com?CR=$CR
The Integration Service sends the source file values to the CR input port of the
HTTP transformation and sends the following HTTP requests to the HTTP
server:
http://www.informatica.com?CR=78576
http://www.informatica.com?CR=78577
http://www.informatica.com?CR=78578
The HTTP server sends an HTTP response back to the Integration Service,
which sends the data through the output port of the HTTP transformation to the
target.
POST Example
The source file used with this example contains the following data:
33,44,1
44,55,2
100,66,0
Figure 8-2 shows that each field in the source file has a corresponding input port:
The Integration Service sends the values of the three fields for each row through
the input ports of the HTTP transformation and sends the HTTP request to the
HTTP server specified in the final URL.
The following text shows the XML file used with this example:
<n4:Envelope>,capeconnect:Clienttest1services:Clienttest1#smplsource