My thoughts would be that it's an issue with TGWS itself (although I don't know anything about it). Suds is just interpreting the communication between your client requests and making them python objects. Apparently the correct details come over the web service call, so they must be coming across in the message you're getting.

some more code surrounding the result:

        except TransportError, e:
            if e.httpcode in (202,204):
                result = None
            else:
                log.error(self.last_sent())
                result = self.failed(binding, e)
        return result


Some method triggered a TransportError, failed() was called, there was a status of 500, and a WebFault was raised.
A TransportError is raised during transport.send(request), and if there's a urllib2.HTTPError...

Now my guess would be that whatever server you have set up to provide these web service calls is returning an http status of 500 with the reply... even though other stuff comes across.

I think you could find out more about the message itself by setting up the debugging stuff in suds to see the messages going in and out. You'd probably be interested in the information in the suds.transport logger to see deeper into where the error might be raised

https://fedorahosted.org/suds/wiki/Documentation#LOGGING

and also simply by seeing the last message that went in and out by using the client, with client.last_sent() and client.last_received()




On Thu, Nov 21, 2013 at 5:33 AM, Gauthier Bastien <gauthier.bastien@imio.be> wrote:
Did you try with suds-jurko?

Have a nice end of day,

Gauthier Bastien
Zoning industriel, 34
5190 Mornimont
Tél: 0032(71)78 09 79
Fax: 0032(65)32 96 79
gauthier.bastien@imio.be

La mutualisation informatique
au service des pouvoirs locaux
Le 21/11/2013 12:31, Matteo Gnudi a écrit :
Hello, I'm using SUDS 0.4 and TGWebServices 1.2.4 to expose a webservice which should return a ComplexType (I'm pretty new to all of this), but something's not working correctly when this WS is invoked: the output is what I expected it to be, but I receive it as the message of a WebFault. Here are the details:

class AuthenticationResponse(object):
    ticket = str
    error = ''
    def __init__(self, error="", ticket=""):
        self.ticket = ticket
        self.error = error

class WebService(WebServicesRoot):

    @wsexpose(AuthenticationResponse)
    @wsvalidate(str,str)
    def authentication(self, username='', password=''):
        result = AuthenticationResponse()
        if not (username and password):
            result.error = "Insert both username and password"; return result
        va = validate_auth(username, encrypt_pw(password)) #Checks if the credentials are valid
        if va:
            ticket = base64.urlsafe_b64encode(uuid.uuid4().bytes).replace('=',  '')
            mem[ticket] = dict(expires = datetime.datetime.now()+datetime.timedelta(hours=1), user = username)
            result.ticket = ticket; return result
        else:
            result.error = "Incorrect username or password"; return result



This is what happens:

client.service.authentication(username='foo', password='bar')
---------------------------------------------------------------------------
WebFault                                  Traceback (most recent call last)

/home/matteo/buildout/trunk/<ipython console> in <module>()

/home/matteo/buildout/eggs/suds-0.4-py2.6.egg/suds/client.pyc in __call__(self, *args, **kwargs)
    540                 return (500, e)
    541         else:
--> 542             return client.invoke(args, kwargs)
    543
    544     def faults(self):

/home/matteo/buildout/eggs/suds-0.4-py2.6.egg/suds/client.pyc in invoke(self, args, kwargs)
    600                 timer)
    601         timer.start()
--> 602         result = self.send(soapenv)
    603         timer.stop()
    604         metrics.log.debug(

/home/matteo/buildout/eggs/suds-0.4-py2.6.egg/suds/client.pyc in send(self, soapenv)
    647             else:
    648                 log.error(self.last_sent())
--> 649                 result = self.failed(binding, e)
    650         return result
    651

/home/matteo/buildout/eggs/suds-0.4-py2.6.egg/suds/client.pyc in failed(self, binding, error)
    700         if status == 500:
    701             if len(reply) > 0:
--> 702                 r, p = binding.get_fault(reply)
    703                 self.last_received(r)
    704                 return (status, p)

/home/matteo/buildout/eggs/suds-0.4-py2.6.egg/suds/bindings/binding.pyc in get_fault(self, reply)
    263         p = unmarshaller.process(fault)
    264         if self.options().faults:
--> 265             raise WebFault(p, faultroot)
    266         return (faultroot, p.detail)
    267

WebFault: Server raised fault: '(('result', <type 'str'>, {'ticket': 'blahblahblahdiblah', 'error': ''}), {}, <bound method SoapController.index of <tgwebservices.soap.SoapController object at 0x1d141d10>>)'

I was expecting an instance of the AuthenticationResponse object with the correct parameters being set.

What am I doing wrong? Is this something about SUDS or TGWS?

Thanks in advance for your support.


_______________________________________________
suds mailing list
suds@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/suds


_______________________________________________
suds mailing list
suds@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/suds