0

I'm setting up a Ladon SOAP server, and can't get it to return lists at all.

Here's what I have:

class V1(object):
    """
    This service returns events between two times for a given trackable.
    """
    @ladonize(rtype=[ PORTABLE_STRING ])
    def getGroupNames(self):
        """
        Returns a list of group names.
        @rtype: List of group names.
        """
        cnn = db.get_connection()
        sql = "blah blah sql"
        params = {}
        groups = db.execute_fetchall(cnn, sql, params)
        ret = []
        for g in groups:
            ret += [g["group_description"]]
        return ret

And the error I'm getting is:

WebFault: Server raised fault: 'Return-type mismatch in V1::getGroupNames: Expected [<type 'unicode'>] recieved <type 'list'>'

It's expecting a list of unicode, and I'm returning a list of unicode, but it's adamant those aren't the same thing.

What am I missing?

TyrantWave
  • 4,583
  • 2
  • 22
  • 25

1 Answers1

0

I haven't used (or heard of) Ladon before this, but it looks like the validation logic is pretty naive. It appears to simply compare type(a) == type(b), which means that, no, you won't be able to describe complex types directly. I think that what you want is called LadonType; see the documentation.

asthasr
  • 9,125
  • 1
  • 29
  • 43
  • Aye, if I hack around with LadonType I can get it to work - if I'm returning a single item. But then once I make a complex type it breaks on dictproxy (I'm not even sure how it would break that, but oh well). Using Ladon because it seems to be the only python SOAP service updated in the past 6 years. – TyrantWave Aug 21 '13 at 13:57
  • @TyrantWave I wouldn't base your choice on recent changes. Apart from bug fixes - I wouldn't expect libraries to have many updates. SOAP's last draft was 2003. So maybe highly active development for a couple of years, then after that - wouldn't expect much at all. – Jon Clements Aug 21 '13 at 14:01
  • Agreed. If I *had* to generate SOAP in Python (which seems like pure suffering), I'd probably go for one of the older options. – asthasr Aug 21 '13 at 14:03
  • @JonClements good point there, but the other issue is that support for the older projects is essentially dead, or in the case of, for example, ZSI they rely on libraries that don't work (pyXML is a nightmare). – TyrantWave Aug 21 '13 at 14:03