Tivoli Directory Integrator, Version 7.1.1

Old HTTP Client Connector

Note:
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 Tivoli® Directory Integrator.

The Old HTTP Client Connector enables greater control on HTTP sessions than the URL Connector provides. With the HTTP Connector you 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.

Note:
The Old HTTP Client Connector does not support the Advanced Link Criteria (see "Advanced link criteria" in IBM Tivoli Directory Integrator V7.1.1 Users Guide).

Modes

The Old HTTP Client Connector can be used in three different AssemblyLine modes. These are:

Iterator
Each call to the Connector requests the same URL configured for the Connector. This causes the Connector to run forever requesting the same page unless you include a Parser in the Connector's configuration. If you include a Parser, the Parser notifies when the last entry has been read from the connection and the Connector eventually causes an AssemblyLine to stop.
Lookup
In this mode the Connector requests a page every time the Lookup function is called. In your search criteria you can specify the page or URL to request, and include any number of parameters all of which are appended to the base URL as request parameters.
AddOnly
In this mode the Connector request is performed much like the Iterator mode.

Lookup Mode

In Lookup mode you can dynamically change the request URL by setting the search criteria as follows:

Special attributes

When using the Connector in Iterator or Lookup mode the following set of attributes or properties is returned in the Connector entry:

http.responseCode
The HTTP response code as an Integer object.

200 OK ---> 200

http.responseMsg
The HTTP response message as a String object.

200 OK ---> OK

http.content-type
The content type for the returned http.body (if any).
http.content-encoding
The encoding of the returned http.body (if any).
http.content-length
The number of bytes in http.body.
http.body
This object is an instance/subclass of java.io.InputStream class that can be used to read bytes of the returned body.
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.
http.text-body
If the http.content-type starts with the sequence text/, the Connector assumes the body is textual data and reads the http.body stream object into this attribute.

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 you must obtain the value in the Connector's After Add hook.

Configuration

The Connector has the following parameters:

HTTP URL
The HTTP page to request.
Request Method
The HTTP method to use when requesting the page. See http://www.w3.org/Protocols/HTTP/Methods.html for more information.
Username
If set, the HTTP Authorization header uses this parameter along with the Password parameter.
Password
Used if Username is specified.
Detailed Log
If this parameter is checked, more detailed log messages are generated.
Parser
If specified, this Parser is used to generate the posted data for an Add operation.

Examples

In your attribute map you 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.

See also

URL Connector,
Old HTTP Server Connector,
HTTP Client Connector.
[ Top of Page | Previous Page | Next Page | Contents | Terms of use | Feedback ]
(C) Copyright IBM Corporation, 2003, 2012. All Rights Reserved.
IBM Tivoli Directory Integrator 7.1.1