Back to Contents


The HTTP Response class

Summary:

See also: The Genero Web ServicesCOM Library


Syntax

The HTTP Response class provides an interface to perform XML and TEXT responses over HTTP, with additional XML streaming possibilities. Notice that status is set to zero after a successful method call.

Syntax

com.HTTPResponse

Methods

Object Methods
Name Description
getStatusCode()
  
RETURNING INTEGER
Returns the HTTP status code.
When the returned HTTP status code is  401 or 407, authorization is required. See the setAuthentication() method of the HTTPRequest class from the Genero Web Services COM Library.
getStatusDescription()
   RETURNING STRING
Returns the HTTP status description.
getHeader(
  name
STRING )
  
RETURNING STRING
Returns the value of the HTTP header name, or NULL if there is none.
Throws an exception in case of errors, and updates status with an error code.
getHeaderCount()
   RETURNING INTEGER
Returns the number of headers.
Throws an exception in case of errors, and updates status with an error code.
getHeaderName(
  index
INTEGER)
   RETURNING STRING
Returns the name of the header at position index.
Throws an exception in case of errors, and updates status with an error code.
getHeaderValue(
  index
INTEGER )
  
RETURNING STRING
Returns the value of the header at position index.
Throws an exception in case of errors, and updates status with an error code.
beginXmlResponse()
   RETURNING
xml.StaxReader
Begins the streaming HTTP response and returns a xml.StaxReader object ready to read XML from the server.
Note: The Content-Type header must be of the form */xml or */*+xml, for instance application/xhtml+xml.
Throws an exception in case of errors, and updates status with an error code.
endXmlResponse(
  reader xml.StaxReader )
Ends the streaming HTTP response by closing the Stax reader.
Throws an exception in case of errors, and updates status with an error code.
getXmlResponse()
  
RETURNING xml.DomDocument
Returns an entire  xml.DomDocument as response from the server.
Note: The Content-Type header must be of the form */xml or */*+xml, for instance application/xhtml+xml.
Throws an exception in case of errors, and updates status with an error code.
getTextResponse()
   RETURNING
STRING
Returns an entire string as response from the server.
Note: The Content-Type header must be of the form text/*, for instance text/richtext.
Note: Automatic conversion to the locale charset is performed when possible, otherwise throws an exception.
Throws an exception in case of errors, and updates status with an error code.

Back to the top


Examples

For examples, refer to The HTTP Request Class Examples.