Summary:
See also: The Genero Web Services COM Library
The HTTPRequest class provides an interface to perform asynchronous XML and TEXT requests over HTTP for a specified URL, with additional XML streaming possibilities.
The status is set to zero after a successful method call.
com.HTTPRequest
Class Methods | |
Name | Description |
com.HTTPRequest.Create( STRING ) RETURNING
com.HTTPRequest |
Creates an
HTTPRequest object by providing a mandatory url
with HTTP or HTTPS as the protocol. Note: url can be an identifier of an URL mapping with an optional alias:// prefix. See FGLPROFILE Configuration for more details about URL mapping with aliases, and for proxy and security configuration. Throws an exception in case of errors, and updates status with an error code. |
Object Methods | |
Name | Description |
setVersion( STRING ) |
Sets the HTTP version
of the request. Accepted versions are 1.0 and 1.1 (only these two versions are supported). The default is 1.1. Throws an exception in case of errors, and updates status with an error code. |
setMethod( STRING ) |
Sets the HTTP method
of the request. Supported methods are GET, PUT, POST, HEAD and DELETE. The default is GET. Throws an exception in case of errors, and updates status with an error code. |
setHeader( STRING, STRING ) |
Sets an HTTP
header name and value for the
request, and replaces the previous one if there was any. Setting a header after the body has been sent, or if a streaming operation has been started, will only be taken into account when a new request is reissued. Throws an exception in case of errors, and updates status with an error code. |
removeHeader( STRING ) |
Removes an HTTP
header name for the request if it exists. Throws an exception in case of errors, and updates status with an error code. |
clearHeaders() |
Removes all user-defined headers. |
setCharset( STRING ) |
Defines the charset
used when sending text or XML; by default no charset is set. When sending text, HTTP specification defines ISO-8859-1 as an implicit charset. When sending XML, the user-defined charset is used instead of the one set in the XML document itself, which can lead to a charset conversion error at the server side. It is recommended that you unset it by setting charset to NULL, or that you use the same charset that was set in the XML Document. |
setAuthentication( STRING, STRING, STRING, STRING ) |
Defines the
mandatory user login and password
to authenticate to the server. An optional scheme defines the method to be used during authentication. Only Anonymous, Basic and Digest are supported. The default is Anonymous. An optional realm can be set.
Throws an exception in case of errors, and updates status with an error code. |
clearAuthentication() |
Removes
user-defined authentication. If an authenticate entry exists in the FGLPROFILE file, it will be used for authentication, even if the user-defined authentication was removed. |
setKeepConnection( INTEGER ) |
Defines whether
the connection should stay open if a new request occurs
again. The default is FALSE. |
setTimeOut( INTEGER ) |
Sets the time
value in seconds to wait for a reading or writing operation, before a
break. The value of -1 means infinite wait. |
setConnectionTimeOut( INTEGER ) |
Sets the time
value in seconds to wait for the establishment of the connection,
before a break. The value of -1 means infinite wait. |
setMaximumResponseLength( INTEGER ) |
Sets the maximum
authorized size in Kbyte of the whole response
(composed of the headers, the body and all control characters), before
a break. The value of -1 means no limit. |
setAutoReply( BOOLEAN ) |
Defines whether method getReponse()
or getAsyncResponse()
will automatically perform another HTTP GET request if response
contains HTTP Authentication, Proxy Authentication or HTTP
redirect data. The efault is TRUE. Note: Only available for GET method. |
Object Methods | |
Name | Description |
doRequest() |
Performs the
request. Supported methods are GET, HEAD and DELETE. Throws an exception in case of errors, and updates status with an error code. |
doTextRequest( STRING ) |
Performs the
request by sending an entire string at once. Supported methods
are PUT and POST.
Throws an exception in case of errors, and updates status with an error code. |
doXmlRequest( |
Performs the
request by sending the entire xml.DomDocument
at once. Supported methods are PUT and POST.
Throws an exception in case of errors, and updates status with an error code. |
doFormEncodedRequest( STRING, INTEGER )
|
Performs an application/x-www-form-urlencoded
Forms encoded query. Supported methods are GET and POST. The query
string is a list of name/value pairs separated with &. For
example, name1=value1&name2=value2&name3=value3. If utf8 is TRUE, the query string is encoded in UTF-8 as specified in XForms 1.0, otherwise in ASCII as specified in HTML 4. Throws an exception in case of errors, and updates status with an error code. |
beginXmlRequest()
RETURNING xml.StaxWriter |
Begins the
streaming HTTP request and returns an xml.StaxWriter object
ready to send XML to the server. Supported methods are PUT and
POST.
Throws an exception in case of errors, and updates status with an error code. |
endXmlRequest( |
Ends the
streaming HTTP request by closing the Stax writer. Throws an exception in case of errors, and updates status with an error code. |
Object Methods | |
Name | Description |
getResponse() RETURNING
com.HTTPResponse |
Returns the
response of one of the doRequest, doTextRequest,
doXmlRequest, doFormEncodedRequest
or beginXmlRequest and endXmlRequest calls in an com.HTTPResponse
object. Throws an exception in case of errors, and updates status with an error code. |
getAsyncResponse()
RETURNING com.HTTPResponse |
Returns the
response of one of the doRequest, doTextRequest,
doXmlRequest, doFormEncodedRequest
or beginXmlRequest and endXmlRequest calls in an com.HTTPResponse
object, or NULL if the response was not yet received. If a previous call returned NULL, a new call will return the expected response if it has already arrived, or NULL again if the response was still not received. Throws an exception in case of errors, and updates status with an error code. |
|
|
|
|