[Twisted-Python] Re: Raise soap faults
Charles Moad
cmoad at indiana.edu
Fri Apr 15 11:28:08 MDT 2005
Why is it you always find the answer to a problem after you ping the
mailing list? For future reference, the deferred returned from the
soap_method should "raise" the faultType in its callbacks, not "return"
it as I was doing.
Thanks,
Charles Moad wrote:
> I have a soap server that I am trying to make handle errors correctly.
> When there is an error I just return a SOAPpy.faultType instance. The
> client should correspondlingly raise a python exception when it gets
> this. Unfortunately it looks like twisted is returning the faultType
> instance as a valid response. Here is the returned SOAP:
>
> *** Incoming SOAP ******************************************************
> <?xml version="1.0" encoding="UTF-8"?>
> <SOAP-ENV:Envelope
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
> <SOAP-ENV:Body>
> <pdbChainFileCompressedResponse SOAP-ENC:root="1">
> <SOAP-ENV:Fault SOAP-ENC:root="1">
> <faultcode>ArgumentError</faultcode>
> <faultstring>Invalid PDB Code</faultstring>
> </SOAP-ENV:Fault>
> </pdbChainFileCompressedResponse>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
> ************************************************************************
>
> and the python result literally is:
>
> <SOAPpy.Types.structType Fault at -1213565780>: {'faultcode':
> 'ArgumentError', 'faultstring': 'Invalid PDB Code'}
>
> So the soappy client is treating this as a valid return value, and not
> raising an exception like it should.
>
> Any ideas?
>
> Thanks,
> Charlie
>
More information about the Twisted-Python
mailing list