arskom/rpclib — Issue #103: Invalid output conversion
Author: azurit
Created: 2011-10-24 14:06:58+00:00
State: open

rpclib is doing invalid output conversion of floats - if your function is supposed to return float and you will return string, value in XML is invalid (see that quotes):

'1.1'

server example:

import logging

from rpclib.application import Application
from rpclib.decorator import srpc
from rpclib.decorator import rpc
from rpclib.interface.wsdl import Wsdl11
from rpclib.protocol.soap import Soap11
from rpclib.service import ServiceBase
from rpclib.model.primitive import Integer
from rpclib.model.primitive import String
from rpclib.model.primitive import Float
from rpclib.model.complex import Array
from rpclib.model.complex import ComplexModel
from rpclib.server.wsgi import WsgiApplication

class tests(ServiceBase):

@rpc(_returns=Float)
def testf(ctx):
return "1.1"

if __name__ == '__main__':
from wsgiref.simple_server import make_server

logging.basicConfig(level=logging.DEBUG)
logging.getLogger('rpclib.protocol.xml').setLevel(logging.DEBUG)

application = Application([tests], 'tests', interface=Wsdl11(), in_protocol=Soap11(validator="soft"), out_protocol=Soap11())

host = "127.0.0.1"
port = 8080

server = make_server(host, port, WsgiApplication(application))

print "listening to http://%s:%s" % (host, port)
print "wsdl is at: http://%s:%s/?wsdl" % (host, port)

server.serve_forever()