Hello!
I'm doing some test codes with Python. I've created a slice definition (Ice_bindings.ice):
So, I've created a the server code (Ser.py):Code:module fase { module bindings { module logging { dictionary<string, string> Message; interface LoggingServer { void NewMessage(Message msg); void log(Message msg); }; }; }; };
and the client (Cli.py):Code:import sys, traceback, Ice Ice.loadSlice("Ice_bindings.ice") import fase.bindings.logging class LoggingServer(fase.bindings.logging.LoggingServer): def log(self, msg): print msg status = 0 ic = None try: ic = Ice.initialize(sys.argv) adapter = ic.createObjectAdapterWithEndpoints( "LoggingServerAdapter", "default -p 10000") logger = LoggingServer() adapter.add(logger, Ice.stringToIdentity("LoggingServer")) adapter.activate() ic.waitForShutdown() except: traceback.print_exc() status = 1 if ic: # Clean up try: ic.destroy() except: traceback.print_exc() status = 1 sys.exit(status)
When I run the client I get this error:Code:import sys, traceback, Ice Ice.loadSlice("Ice_bindings.ice") import fase.bindings.logging status = 0 ic = None try: ic = Ice.initialize(sys.argv) base = ic.stringToProxy("LoggingServer:tcp default -p 10000") logger = fase.bindings.logging.LoggingServerPrx.checkedCast(base) if not logger: raise RuntimeError("Invalid proxy") logger.log({"pippo":"pluto"}) except: traceback.print_exc() status = 1 if ic: # Clean up try: ic.destroy() except: traceback.print_exc() status = 1 sys.exit(status)
and the server says:Code:Traceback (most recent call last): File "Cli.py", line 16, in ? logger.log({"pippo":"pluto"}) File "Ice_bindings.ice", line 50, in log UnknownException: exception ::Ice::UnknownException { unknown = exceptions.TypeError: log() takes exactly 2 arguments (3 given) }
What I'm mistaking?Code:Ser.py: warning: dispatch exception: Util.cpp:132: Ice::UnknownException: unknown exception: exceptions.TypeError: log() takes exactly 2 arguments (3 given) identity: LoggingServer facet: operation: log
Thank you in advance.

Reply With Quote