[Twisted-Python] Raise soap faults

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

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

On Fri, 15 Apr 2005 11:39:03 -0500, Charles Moad <cmoad@indiana.edu> 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:
Yeah, I think that is right. I believe you are supposed to raise an exception from your soap_* methods if you want a real SOAP fault to be returned. You may simply raise your faultType instance, or a faultType instance will be created automatically. Though on the client side it still won't raise an exception, but you will hopefully get your faultType instance. You may check for it explicitly and raise it, if you like. This behavior is probably wrong, and should be modified to be more in line with our other RPC implementations and SOAPpy itself. It would also be nice for Twisted to assert that the user isn't returning faultType instances from their soap_* methods, and if they are to advise them of the correct procedure. Would you please open a bug on the tracker and assign it to me? http://twistedmatrix.com/bugs/ Itamar, you're listed as the soap.py maintainer.. does this sound about right to you? -Eric
*** 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
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

def deferredReady(value=False,later=0): deferred=Deferred() reactor.callLater(later,deferred.callback,value) return deferred def generatorLoop(generator,listOfParams,multi=False): lista=[] for params in listOfParams: if multi: lista.append(deferredGenerator(generator)(*params)) else: lista.append(deferredGenerator(generator)(params)) return DeferredList(lista) Thanks Paolino

On Sat, 16 Apr 2005 18:50:02 +0000, User Paolino <paolo_veronelli@yahoo.it> wrote:
def deferredReady(value=False,later=0): deferred=Deferred() reactor.callLater(later,deferred.callback,value) return deferred
def generatorLoop(generator,listOfParams,multi=False): lista=[] for params in listOfParams: if multi: lista.append(deferredGenerator(generator)(*params)) else: lista.append(deferredGenerator(generator)(params)) return DeferredList(lista)
What? Also, why? Jp

Jp Calderone wrote:
On Sat, 16 Apr 2005 18:50:02 +0000, User Paolino <paolo_veronelli@yahoo.it> wrote:
def deferredReady(value=False,later=0): deferred=Deferred() reactor.callLater(later,deferred.callback,value) return deferred
def generatorLoop(generator,listOfParams,multi=False): lista=[] for params in listOfParams: if multi: lista.append(deferredGenerator(generator)(*params)) else: lista.append(deferredGenerator(generator)(params)) return DeferredList(lista)
What? Also, why?
deferredReady is just missing in the library ,it's useful to let other code execute in situations where calling functions are gready, like resolving recursive query. the second I use it everywhere where the cycles of a loop can be executed in parallel as they are independent. But I see, small things are not interesting ... np

On Wed, 2005-04-20 at 17:06 +0000, User Paolino wrote:
But I see, small things are not interesting ...
It's not that they're not interesting, it's just that patches should probably come with an explanation of what they're for so we can review them better. Also, if you add them to http://twistedmatrix.com/bugs/ they won't get lost in the list archives.
participants (5)
-
Charles Moad
-
Eric Mangold
-
Itamar Shtull-Trauring
-
Jp Calderone
-
User Paolino