Compression and a Web services client
Send and receive compressed requests from a Web services client.
When you create a low-level Web service and do not have any stubs created by fglwsdl, you need to manage it by setting the HTTP headers.
Send a compressed request
The method used to set up the client for sending a compressed request depends on whether the Genero Web Services client is a high-level or low-level Web services client. A high-level client is a Genero Web Services client that includes the stub files created by the fglwsdl tool. A low-level client is a Genero Web Services client that does not utilize stub files created by the fglwsdl tool.
Regardless of the type of client, the server must be set up to handle such compression, otherwise the request will be rejected.
Send a compressed request from a high-level client
Binding.CompressRequest
to either "gzip" or
"deflate".LET EchoDocStyle_EchoDocStylePortTypeEndpoint.Binding.CompressRequest = "gzip"
Binding.CompressRequest
variable is defined in the stub file, specifically
the client's global (inc)
file.#
# Global Endpoint user-defined type definition
#
TYPE tGlobalEndpointType RECORD # End point
Address RECORD # Address
Uri STRING # URI
END RECORD,
Binding RECORD # Binding
Version STRING, # HTTP Version (1.0 or 1.1)
Cookie STRING, # Cookie to be set
ConnectionTimeout INTEGER, # Connection timeout
ReadWriteTimeout INTEGER, # Read write timeout
CompressRequest STRING # HTTP request compression mode (gzip or deflate)
END RECORD
END RECORD
#
# Location of the SOAP endpoint.
# You can reassign this value at run-time.
#
DEFINE EchoDocStyle_EchoDocStylePortTypeEndpoint tGlobalEndpointType
Send a compressed request from a low-level client
A low-level client is a Genero Web Services client that does not utilize stub files created by the fglwsdl tool.
Set the Content-Encoding
field in the request header to either "gzip" or
"deflate".
This example sets the Content-Encoding
field to "gzip", where the request is a
com.HTTPRequest
object.
CALL request.setHeader("Content-Encoding","gzip")
Accept a compressed response
A Genero Web Services client can accept a compressed request if it sets the
Accept-Encoding
field in the header to "gzip, deflate". These values represent
supported compression schema names (called content-coding tokens) separated by commas.
This example sets the Accept-Encoding
field with the setHeader
method, where the request is a com.HTTPRequest
object.
CALL request.setHeader("Accept-Encoding","gzip, deflate")