Hi, I had some issues with XMLRPCServer and I try to validate my workaround.
My first try was this (somewhat self explaining code): from DocXMLRPCServer import DocXMLRPCServer from cx_Oracle import connect def get_task_list(user): sql = """ select ISS.ISS_ISSUE_NUMBER , ISS.ISS_DESCRIPTION , ISS.C_PC_ISS_STATUS , ISS.ISS_IN_WORK , ISS.PC_ISSUES_ID , DES.GCDTEXT1 from ... where ... """ con = connect('DEVELOP/[EMAIL PROTECTED]') cur = con.cursor() cur.execute(sql, USE_NAME = user.upper()) result = cur.fetchall() cur.close() con.close() return result server = DocXMLRPCServer(("localhost", 8000)) server.register_function(get_task_list) server.serve_forever() But I had 2 errors with this code: -PC_ISSUES_ID column could be an integer of 12 digits but the XML generator only allow 2L**31-1 long integer, so I had an Overflowexception: long int exceeds XML-RPC. -Text columns (like ISS_DESCRIPTION) could contains non ascii char. (éàç) but the server doesn't allow to specify the encoding to use for the XML, so parser error on non-ascii char. on the client side (ExpatError: not well-formed (invalid token)). My working code with workarounds for these issues is: from DocXMLRPCServer import DocXMLRPCServer from cx_Oracle import connect #increase MAXINT constant to allow 12 digits integer for PC_ISSUES_ID #(long int exceeds XML-RPC exception) import xmlrpclib xmlrpclib.MAXINT = 999999999999 def get_task_list(user): sql = """ select ISS.ISS_ISSUE_NUMBER , ISS.ISS_DESCRIPTION , ISS.C_PC_ISS_STATUS , ISS.ISS_IN_WORK , ISS.PC_ISSUES_ID , DES.GCDTEXT1 from ... where ... """ con = connect('DEVELOP/[EMAIL PROTECTED]') cur = con.cursor() cur.execute(sql, USE_NAME = user.upper()) result = cur.fetchall() cur.close() con.close() #convert string column to unicode (XML generator does not use # encoding so string must be UTF8 or unicode) result = [list(row) for row in result] for row in result: for count, x in enumerate(row): if isinstance(x, str): row[count] = x.decode('cp1252') return result server = DocXMLRPCServer(("localhost", 8000)) server.register_function(get_task_list) server.serve_forever() But it seems to me not very clean, especially the MAXINT hack. Has anyone a better solution ? -- http://mail.python.org/mailman/listinfo/python-list