zserio.service module

The module provides classes for Zserio services.

class zserio.service.ObjectServiceData(zserio_object: Any)[source]

Bases: ServiceData

ServiceData implementation based on object generated by Zserio.

Constructor.

Parameters:

zserio_object – Zserio object from which to create service data.

property byte_array: bytes

Gets the data which represent the request.

Returns:

The request data which are created by serialization of Zserio object.

property zserio_object: Any

Gets the Zserio object which represents the request.

Returns:

The Zserio object.

class zserio.service.RawServiceData(raw_data: bytes)[source]

Bases: ServiceData

Service data implementation based on raw data.

Constructor.

Parameters:

raw_data – Raw data to use.

property byte_array: bytes

Gets the data which represent the request.

Returns:

The request data.

property zserio_object: None

Gets the Zserio object which represents the request if available.

Returns:

The Zserio object or None.

class zserio.service.ServiceClientInterface[source]

Bases: object

Generic interface for all Zserio services on client side.

call_method(method_name: str, request: ServiceData, context: Any | None = None) bytes[source]

Calls method with the given name synchronously.

Parameters:
  • method_name – Name of the service method to call.

  • request – Request service data to be passed to the method.

  • context – Context specific for particular service.

Returns:

Response data.

Raises:

ServiceException – If the call fails.

class zserio.service.ServiceData[source]

Bases: object

Data abstraction to be sent or to be received in all Zserio services.

property byte_array: bytes

Gets the data which represent the request.

Returns:

The request data.

property zserio_object: Any

Gets the Zserio object which represents the request if available.

Returns:

The Zserio object or None.

exception zserio.service.ServiceException[source]

Bases: PythonRuntimeException

Exception thrown in case of an error in Zserio Service

class zserio.service.ServiceInterface[source]

Bases: object

Generic interface for all Zserio services on server side.

call_method(method_name: str, request_data: bytes, context: Any | None = None) ServiceData[source]

Calls method with the given name synchronously.

Parameters:
  • method_name – Name of the service method to call.

  • request_data – Request data to be passed to the method.

  • context – Context specific for particular service.

Returns:

Response service data.

Raises:

ServiceException – If the call fails.

property method_names: List

Gets list of service method names.

Returns:

List of service method names.

property service_full_name: str

Gets service full name.

Returns:

Service full name.