I'm interested in writing a python client for a web-service, and for testing purposes it would be very interesting also to have a simple stub server. I'm using python 2.3, and ZSI 2.0.
My problem is that I do not manage to return an exception from the server.
If I raise an exception of the type used for the soap fault in the wsdl, I get the TypeError 'exceptions must be classes, instances, or strings (deprecated), not EmptyStringException_Def'. I thought this meant that the fault object was not a subclass of Exception, but modifying the generated code in this way did not help - and of course, not having to modify the generated code would be much better :)
If I return the fault object as part of the response, it is just ignored.
I couldn't find any documentation about faults handling in ZSI. Any hints?
Here's a sample code for a server of a very simple service with just one method, spellBackwards, which should return a soap fault if the input string is empty:
#!/usr/bin/env python
from ZSI.ServiceContainer import AsServer
from SpellBackwardsService_services_server import *
from SpellBackwardsService_services_types import *
class SpellBackwardsServiceImpl(SpellBackwardsService):
    def soap_spellBackwards(self, ps):
        response = SpellBackwardsService.soap_spellBackwards(self, ps)
        input = self.request._in
        if len(input) != 0:
            response._out = input[::-1]
        else:
            e = ns0.EmptyStringException_Def("fault")
            e._reason = "Empty input string"
            # The following just produces an empty return message:
            # response._fault = e
            # The following causes TypeError
            # raise e
        return response
AsServer(port=8666, services=[SpellBackwardsServiceImpl(),])