This Connector is kept for legacy purposes only. If you are setting up a new Connector, please use the HTTP Client Connector instead. It is also deprecated, and will be removed in a future version of TDI.
The Old HTTP Client Connector enables greater control on HTTP sessions than the URL Connector provides. With the HTTP Connector we can set HTTP headers and body using predefined attributes. Also, any request to a server that returns data is available for the user as attributes.
The Old HTTP Client Connector does not support the Advanced Link Criteria (see "Advanced link criteria" in IBM TDI V7.1 Users Guide).
The Old HTTP Client Connector can be used in three different AssemblyLine modes. These are:
In Lookup mode we can dynamically change the request URL by setting the search criteria as follows:
url equals $url
Base URL: http://www.example_name.com/lookup.cgi
Search Criteria:
name equals john mail equals doe.com
Resulting URL: http://www.example_name.com/lookup.cgi?name=john&mail=doe.comThe Lookup function ignores the operand. So if you specify contains instead of equals the Connector still constructs the URL as if equals where used.
When using the Connector in Iterator or Lookup mode the following set of attributes or properties is returned in the Connector entry:
200 OK ---> 200
200 OK ---> OK
var body = conn.getObject ("http.body"); var ch; while ( (ch = body.read()) != -1 ) { task.logmsg ("Next character: " + ch); }Consult the Javadocs for the InputStream classes and their methods.
When using the Connector in AddOnly mode the Connector transmits any attribute named http. as a header. Thus, to set the content type for a request, name the attribute http.content-type and provide the value as usual. One special attribute is http.body that can contain a string or any java.io.InputStream or java.io.Reader subclass.
For all modes the Connector always sets the http.responseCode and http.responseMsg attributes. In AddOnly mode this is a bit special since the conn object being passed to the Connector is the object being populated with these attributes. To access these obtain the value in the Connector's After Add hook.
The Connector has the following parameters:
In your attribute map we can use the following assignment to post the contents of a file to the HTTP server:
// Attribute assignment for "http.body" ret.value = new java.io.FileInputStream ("myfile.txt"); // Attribute assignment for "http.content-type" ret.value = "text/plain";
The Connector computes the http.content-length attribute for you. There is no need to specify this attribute.
URL Connector,
Old HTTP Server Connector,
HTTP Client Connector.