Is it possible to return a simple array of arrays using ladon?

Asked by armonge on 2012-05-23

I'm coding a webservice according to http://pastebin.com/03fjmQSU
Ladon's been great and proved to be simple to use, however i can't get the desired ouput

from ladon.ladonizer import ladonize
from ladon.compat import PORTABLE_STRING
from ladon.types.ladontype import LadonType

class Array(LadonType):
    content = [PORTABLE_STRING]

class HDClaro(object):
    @ladonize(PORTABLE_STRING, PORTABLE_STRING,rtype=[Array], replaces={'pass_': 'pass'})
    def consultaServicios(self,movil,pass_, *args, **kwargs):

What i need is something on the lines of:
Array
(
    [0] => Array
        (
            [0] => COLOR // NOMBRE DEL SERVICIO
            [1] => 0 // ESTADO DEL SERVICIO 1= ACTIVO, 0= CANCELADO
            [2] => 4.00 // COBRO POR EL SERVICIO
            [3] => 30501 // MARCACION CORTA DE SUSCRIPCION
            [4] => 3050 // MARCACION CORTA DE BAJA
            [5] => 23/11/2010 // FECHA DE SUSCRIPCION
            [6] => 14:35:23 // HORA DE SUSCRIPCION
            [7] => SMS // MEDIO DE SUSCRIPCION
            [8] => 24/11/2010 // FECHA DE BAJA (EN CASO QUE EL ESTADO DE SERVICIO = 0)
            [9] => 13:14:50 // HORA DE BAJA (EN CASO QUE EL ESTADO DE SERVICIO = 0)
            [10] => SMS // MEDIO DE BAJA (EN CASO QUE EL ESTADO DE SERVICIO = 0)
        )

    [1] => Array  // UN SUB-ARRAY POR CADA REGISTRO
        (
            [0] => AMOR
            [1] => 0
            [2] => 4.00
            [3] => 30501
            [4] => 3050
            [5] => 24/11/2010
            [6] => 13:19:54
            [7] => SMS
            [8] => 24/11/2010
            [9] => 13:21:18
            [10] => SMS
        )
)

But I'm getting:

Array
(
    [item] => Array
        (
            [0] => Array
                (
                    [content] => Array
                        (
                            [item] => Array
                                (
                                    [0] => NI - 4545 - Ser lider
                                    [1] => 1
                                    [2] => 0.0
                                    [3] => 505500
                                    [4] =>
                                    [5] => 29/04/2012
                                    [6] => 16:54:24
                                    [7] => Broadcast Claro
                                    [8] => 29/04/2012
                                    [9] => 17:18:56
                                    [10] => Baja Operador
                                )

                        )

                )

            [1] => Array
                (
                    [content] => Array
                        (
                            [item] => Array
                                (
                                    [0] => NI - 4545 - Ser lider
                                    [1] => 1
                                    [2] => 0.0
                                    [3] => 505500
                                    [4] =>
                                    [5] => 29/04/2012
                                    [6] => 17:19:09
                                    [7] => Broadcast Claro
                                    [8] => 29/04/2012
                                    [9] => 17:21:55
                                    [10] => Baja Operador
                                )

                        )

                )

Any help on the direction would be greatly appreciated, also I'd be willing to work on Ladon itself if i get some mentoring

Question information

Language:
English Edit question
Status:
Answered
For:
ladon Edit question
Assignee:
No assignee Edit question
Last query:
2012-05-23
Last reply:
2012-06-07
jsgaarde (jakob-simon-gaarde) said : #1

Hi armonge

It seems like what you could expect from SOAP. The final response structure depends very much on the SOAP client you are using.
Maybe you should consider using Ladon's JSONWSP protocol instead?

/ Jakob

oyzzo (oyzzoforfree) said : #2

Hi armonge,

I've used complex data types on ladon over SOAP and it worked just perfect, take a look at the examples at http://www.ladonize.org/index.php/Python_Example there's an example similar to what you try to do.
A tool i've used a lot to test my webservices without the need of coding clients every test i wanted to do is http://www.validwsdl.com/ maybe it helps you during the process.

Can you help with this problem?

Provide an answer of your own, or ask armonge for more information if necessary.

To post a message you must log in.