The central node of pyws infrastructure is a server, it is defined in module pyws.server. There are two classes defined: Server (a generic server) and SoapServer. There is only one difference between them, namely the latter has a SOAP protocol registered beforehand.
The easiest way to create a generic server is this:
from pyws.server import Server
server = Server(settings)
To create a SOAP server:
from pyws.server import SoapServer
server = SoapServer(
settings,
service_name='Test',
tns='http://example.com/',
location='http://localhost:8000/api/',
)
In both cases settings may be a dict or an object (a module object as well) containing some, well, settings. Other parameters in the case of a SOAP server are:
A server has the following settings variables.
NAME is used to identify a pyws server. For example, if you have several pyws servers, you have to specify a server name to register a function to it. Server name is unique, thus creating two servers with the same name raises an exception. Default is None.
If DEBUG is True a server will not catch exceptions occuring in registered functions, but rather it will just pass them further so that you could handle them your own way. For example, Django in debug mode will print a pretty formatted stack trace. Default is False.
A tuple of protocol instances that a server will use to process requests. For SoapServer default is a tuple of a single SOAP protocol instance. For a generic Server there are no protocol predefined, so make sure you’ve register at least one yourself.
A tuple of function managers that provide a server with functions. Default is a tuple of a single fixed function manager.