Request
and
response
objects encapsulate information regarding the data a service
receives and produces. Both objects will always exist for each service invocation
but their payload can be empty, it’s perfectly fine for a service not to accept
any input data nor to create output either.

An instance of
zato.server.service.Response
class, self.response attribute of each service instance influences what the application
invoking a service will receive.

Attribute

Notes

payload

A service can assign output parameters directly to payload
if SIO is used.

In any other case, payload must be assigned a string containing
the response.

result

Defaults to ZATO_OK and must be either ZATO_OK or ZATO_ERROR from
zato.common.
If the latter, an exception will be raised and signalled to the
calling invocation in a transport-specific way, e.g. using
a Fault message for SOAP channels. A proper status_code will
be returned too.

result_details

If result is ZATO_ERROR, any details the client application should receive.

content_type

HTTP only. Value of the Content-Type header to return. Sane
defaults are used:

'application/json' for JSON channels

'application/xml' for Plain HTTP channels with XML data format

'application/xml' for SOAP 1.1

'application/soap+xml; charset=utf-8' for SOAP 1.2

headers

HTTP only. A dictionary of headers you'd like for the service to return.

status_code

HTTP only. Status code a service returns. Must be one of the responses
httplib
defines. Defaults to httplib.OK

Note

As an aid during development and debugging, a service can log its output
using the
log_output
method.